Skip to content

Commit

Permalink
macOS big sur fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eranif committed Mar 4, 2021
1 parent c74ca14 commit 7e770fe
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 28 deletions.
2 changes: 1 addition & 1 deletion CodeLiteIDE-macOS.workspace
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"debugger": "GNU gdb debugger"
}, {
"name": "Release",
"targets": [["Run CMake - Release", "mkdir -p build-release && cd build-release && cmake -DCMAKE_BUILD_TYPE=Release .."], ["build", "cd build-release && make -j8"], ["clean", "cd build-release && make -j8 clean"]],
"targets": [["Run CMake - Release", "mkdir -p build-release && cd build-release && cmake -DCMAKE_BUILD_TYPE=Release .."], ["build", "cd build-release && make -j8 install"], ["clean", "cd build-release && make -j8 clean"]],
"file_extensions": "*.cpp;*.c;*.txt;*.json;*.hpp;*.cc;*.cxx;*.xml;*.h;*.wxcp",
"excludeFilesPattern": "*.o;*.pyc;*.obj;*.workspace;*.o.d;*.exe;*.dll;*.project",
"excludePaths": "codelite-cli;codelite-icons;codelite-icons-dark;codelite-icons-fresh-farm;codelite-stdio;codelite_echo;codelite_launcher;codelite_make;bitmaps;bitmaps-dark;bitmaps-light;build-release;CallGraph",
Expand Down
3 changes: 3 additions & 0 deletions LiteEditor/mainbook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ void MainBook::CreateGuiControls()
if(clConfig::Get().Read("HideTabBar", false)) {
style |= kNotebook_HideTabBar;
}

#ifdef __WXMSW__
style |= wxBORDER_SIMPLE;
#endif

// load the notebook style from the configuration settings
m_book = new Notebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style);
Expand Down
27 changes: 22 additions & 5 deletions Plugin/clTabRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,20 @@ void clTabColours::UpdateColours(size_t notebookStyle)
wxUnusedVar(notebookStyle);
wxColour base_colour = clSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
bool is_dark = DrawingUtils::IsDark(base_colour);
#ifdef __WXOSX__
tabAreaColour = base_colour.ChangeLightness(80);
activeTabBgColour = base_colour;
activeTabTextColour = clSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT);
activeTabPenColour = base_colour;
activeTabInnerPenColour = activeTabPenColour;

// inactive tab colours
inactiveTabTextColour = activeTabTextColour;
inactiveTabBgColour = tabAreaColour;
inactiveTabPenColour = tabAreaColour.ChangeLightness(90);
inactiveTabInnerPenColour = inactiveTabBgColour;

#else
tabAreaColour = base_colour.ChangeLightness(80);

// active tab colours
Expand All @@ -47,15 +60,12 @@ void clTabColours::UpdateColours(size_t notebookStyle)

// inactive tab colours
inactiveTabTextColour = activeTabTextColour;
#ifdef __WXOSX__
inactiveTabBgColour = tabAreaColour.ChangeLightness(105);
#else
inactiveTabBgColour = tabAreaColour.ChangeLightness(110);
#endif
inactiveTabPenColour = activeTabPenColour.ChangeLightness(110);
inactiveTabInnerPenColour = inactiveTabBgColour;

// the marker colour
#endif
markerColour = clConfig::Get().Read("ActiveTabMarkerColour", wxColour("#dc7633"));
}

Expand Down Expand Up @@ -265,9 +275,13 @@ clTabRenderer::clTabRenderer(const wxString& name, const wxWindow* parent)
wxFont clTabRenderer::GetTabFont(bool bold)
{
wxFont f = DrawingUtils::GetDefaultGuiFont();
#ifdef __WXOSX__
wxUnusedVar(bold);
#else
if(bold) {
f.SetWeight(wxFONTWEIGHT_BOLD);
}
#endif
return f;
}

Expand Down Expand Up @@ -413,6 +427,8 @@ void clTabRenderer::DrawBackground(wxWindow* parent, wxDC& dc, const wxRect& cli
#endif
dc.SetBrush(colours.tabAreaColour);
dc.DrawRectangle(clientRect);

#ifndef __WXOSX__
bool isBottom = style & kNotebook_BottomTabs;
bool isLeft = style & kNotebook_LeftTabs;
bool isRight = style & kNotebook_RightTabs;
Expand All @@ -431,8 +447,9 @@ void clTabRenderer::DrawBackground(wxWindow* parent, wxDC& dc, const wxRect& cli
p1 = clientRect.GetBottomLeft();
p2 = clientRect.GetBottomRight();
}
dc.SetPen(colours.activeTabPenColour);
dc.SetPen(colours.inactiveTabPenColour);
dc.DrawLine(p1, p2);
#endif
}

void clTabRenderer::FinaliseBackground(wxWindow* parent, wxDC& dc, const wxRect& clientRect,
Expand Down
51 changes: 29 additions & 22 deletions Plugin/clTabRendererClassic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,29 +47,8 @@ void clTabRendererClassic::Draw(wxWindow* parent, wxDC& dc, wxDC& fontDC, const
bool isLeft = style & kNotebook_LeftTabs;
bool isRight = style & kNotebook_RightTabs;

wxPoint p1, p2;
if(isBottom) {
p1 = tabRect.GetTopLeft();
p2 = tabRect.GetTopRight();
} else if(isLeft) {
p1 = tabRect.GetTopRight();
p2 = tabRect.GetBottomRight();
} else if(isRight) {
p1 = tabRect.GetTopLeft();
p2 = tabRect.GetBottomLeft();
} else {
p1 = tabRect.GetBottomLeft();
p2 = tabRect.GetBottomRight();
}

clTabColours colours = colors;
bool isDark = DrawingUtils::IsDark(colours.activeTabBgColour);
// if(isDark) {
// InitDarkColours(colours, colours.activeTabBgColour);
// } else {
// InitLightColours(colours, colours.activeTabBgColour);
// }

wxColour bgColour(tabInfo.IsActive() ? colours.activeTabBgColour : colours.inactiveTabBgColour);
wxColour penColour(tabInfo.IsActive() ? colours.activeTabPenColour : colours.inactiveTabPenColour);

Expand Down Expand Up @@ -127,8 +106,36 @@ void clTabRendererClassic::Draw(wxWindow* parent, wxDC& dc, wxDC& fontDC, const
DrawButton(parent, dc, tabInfo, colours, buttonState);
}

wxPoint p1, p2;
if(isBottom) {
p1 = tabRect.GetTopLeft();
p2 = tabRect.GetTopRight();
} else if(isLeft) {
p1 = tabRect.GetTopRight();
p2 = tabRect.GetBottomRight();
} else if(isRight) {
p1 = tabRect.GetTopLeft();
p2 = tabRect.GetBottomLeft();
} else {
p1 = tabRect.GetBottomLeft();
p2 = tabRect.GetBottomRight();
}

if(!tabInfo.IsActive()) {
dc.SetPen(colours.activeTabPenColour);
dc.SetPen(colours.activeTabBgColour.ChangeLightness(50));
p1.y += 1;
p2.y += 1;
dc.DrawLine(p1, p2);
} else {
p1 = tabRect.GetRightTop();
p2 = tabRect.GetBottomRight();
p2.y -= 1; // don't override the bottom line
dc.SetPen(colours.activeTabBgColour.ChangeLightness(110));
dc.DrawLine(p1, p2);

p1 = tabRect.GetLeftTop();
p2 = tabRect.GetLeftBottom();
p2.y -= 1; // don't override the bottom line
dc.DrawLine(p1, p2);
}
}
Expand Down

0 comments on commit 7e770fe

Please sign in to comment.