Skip to content

Commit

Permalink
added hi-res images for the notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
עירן יפרח committed Nov 2, 2015
1 parent 1c639ed commit e56f66b
Show file tree
Hide file tree
Showing 17 changed files with 1,519 additions and 1,386 deletions.
4 changes: 2 additions & 2 deletions Notebook.workspace
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<CodeLite_Workspace Name="Notebook" Database="">
<Project Name="Notebook" Path="Notebook/Notebook.project" Active="Yes"/>
<BuildMatrix>
<WorkspaceConfiguration Name="Debug" Selected="yes">
<WorkspaceConfiguration Name="Debug" Selected="no">
<Project Name="Notebook" ConfigName="Debug"/>
</WorkspaceConfiguration>
<WorkspaceConfiguration Name="Release" Selected="no">
Expand All @@ -11,7 +11,7 @@
<WorkspaceConfiguration Name="Debug_Linux" Selected="no">
<Project Name="Notebook" ConfigName="Debug_Linux"/>
</WorkspaceConfiguration>
<WorkspaceConfiguration Name="osx" Selected="no">
<WorkspaceConfiguration Name="osx" Selected="yes">
<Project Name="Notebook" ConfigName="osx"/>
</WorkspaceConfiguration>
</BuildMatrix>
Expand Down
3 changes: 3 additions & 0 deletions Notebook/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

<key>CFBundleExecutable</key>
<string>Notebook</string>

<key>NSPrincipalClass</key>
<string>NSApplication</string>

<key>CFBundleGetInfoString</key>
<string>Notebook, version 1.0, copyright myself</string>
Expand Down
50 changes: 29 additions & 21 deletions Notebook/Notebook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ wxDEFINE_EVENT(wxEVT_BOOK_TABAREA_DCLICKED, wxBookCtrlEvent);

extern void Notebook_Init_Bitmaps();

Notebook::Notebook(wxWindow* parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
static int GetBitmapWidth(const wxBitmap& bmp) { return bmp.GetWidth() / bmp.GetScaleFactor(); }

static int GetBitmapHeight(const wxBitmap& bmp) { return bmp.GetHeight() / bmp.GetScaleFactor(); }

Notebook::Notebook(
wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
: wxPanel(parent, id, pos, size, wxNO_BORDER | wxWANTS_CHARS | wxTAB_TRAVERSAL, name)
{
static bool once = false;
Expand All @@ -66,20 +66,20 @@ Notebook::Notebook(wxWindow* parent,
wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
Notebook_Init_Bitmaps();
once = true;
}
}

m_tabCtrl = new clTabCtrl(this, style);
m_windows = new WindowStack(this);
wxBoxSizer* sizer ;

wxBoxSizer* sizer;
if(IsVerticalTabs()) {
sizer = new wxBoxSizer(wxHORIZONTAL);
} else {
sizer = new wxBoxSizer(wxVERTICAL);
}

SetSizer(sizer);

if(GetStyle() & kNotebook_BottomTabs) {
sizer->Add(m_windows, 1, wxEXPAND);
sizer->Add(m_tabCtrl, 0, wxEXPAND);
Expand Down Expand Up @@ -166,14 +166,19 @@ void Notebook::SetTabDirection(wxDirection d)
flags &= ~kNotebook_BottomTabs;
flags &= ~kNotebook_LeftTabs;
flags &= ~kNotebook_RightTabs;

#ifdef __WXOSX__
if(d == wxBOTTOM || d == wxRIGHT) {
flags |= kNotebook_BottomTabs;
}
#else
if(d == wxBOTTOM) {
flags |= kNotebook_BottomTabs;
} else if(d == wxRIGHT) {
flags |= kNotebook_RightTabs;
} else if(d == wxLEFT) {
flags |= kNotebook_LeftTabs;
}
#endif
SetStyle(flags);
}

Expand Down Expand Up @@ -467,8 +472,8 @@ void clTabInfo::CalculateOffsets(size_t style)
if(m_bitmap.IsOk()) {
m_bmpX = m_width;
m_width += X_SPACER;
m_width += m_bitmap.GetWidth();
m_bmpY = ((m_height - m_bitmap.GetHeight()) / 2);
m_width += GetBitmapWidth(m_bitmap);
m_bmpY = ((m_height - GetBitmapHeight(m_bitmap)) / 2);
}

// Text
Expand Down Expand Up @@ -677,7 +682,9 @@ void clTabCtrl::OnEraseBG(wxEraseEvent& e) { wxUnusedVar(e); }

void clTabCtrl::OnPaint(wxPaintEvent& e)
{
wxBufferedPaintDC dc(this);
wxAutoBufferedPaintDC dc(this);
PrepareDC(dc);

wxRect clientRect(GetClientRect());
if(clientRect.width <= 3) return;
if(clientRect.height <= 3) return;
Expand Down Expand Up @@ -747,6 +754,7 @@ void clTabCtrl::OnPaint(wxPaintEvent& e)
// wxBitmap bmpTabs(rect.GetSize());
// wxMemoryDC memDC(bmpTabs);
wxGCDC gcdc(dc);
PrepareDC(gcdc);

gcdc.SetPen(tabAreaBgCol);
gcdc.SetBrush(tabAreaBgCol);
Expand Down Expand Up @@ -792,9 +800,9 @@ void clTabCtrl::OnPaint(wxPaintEvent& e)
if((GetStyle() & kNotebook_ShowFileListButton)) {
// Draw the chevron
wxCoord chevronX =
m_chevronRect.GetTopLeft().x + ((m_chevronRect.GetWidth() - m_colours.chevronDown.GetWidth()) / 2);
wxCoord chevronY =
m_chevronRect.GetTopLeft().y + ((m_chevronRect.GetHeight() - m_colours.chevronDown.GetHeight()) / 2);
m_chevronRect.GetTopLeft().x + ((m_chevronRect.GetWidth() - GetBitmapWidth(m_colours.chevronDown)) / 2);
wxCoord chevronY = m_chevronRect.GetTopLeft().y +
((m_chevronRect.GetHeight() - GetBitmapHeight(m_colours.chevronDown)) / 2);
// dc.SetPen(activeTabColours.tabAreaColour);
// dc.SetBrush(*wxTRANSPARENT_BRUSH);
// dc.DrawRectangle(m_chevronRect);
Expand Down Expand Up @@ -1788,17 +1796,17 @@ void clTabCtrl::OnRightUp(wxMouseEvent& event)
if((GetStyle() & kNotebook_ShowFileListButton) && m_chevronRect.Contains(event.GetPosition())) {
return;
}

int tabHit, realPos;
TestPoint(event.GetPosition(), realPos, tabHit);

// Did we hit the active tab?
bool clickWasOnActiveTab = (GetSelection() == realPos);
if(clickWasOnActiveTab && m_contextMenu) {
// don't fire this event, we already got a context menu for the active tab
return;
}

if(tabHit != wxNOT_FOUND) {
// Fire RCLICK event
wxBookCtrlEvent event(wxEVT_BOOK_TAB_RCLICK);
Expand Down
10 changes: 10 additions & 0 deletions Notebook/Notebook.project
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@
<File Name="notebook_bitmaps.cpp"/>
<File Name="windowstack.cpp"/>
<File Name="windowstack.h"/>
<VirtualDirectory Name="bitmaps">
<File Name="bitmaps/chevron-down-black.png"/>
<File Name="bitmaps/[email protected]"/>
<File Name="bitmaps/chevron-down-grey.png"/>
<File Name="bitmaps/[email protected]"/>
<File Name="bitmaps/fileclose-white.png"/>
<File Name="bitmaps/[email protected]"/>
<File Name="bitmaps/fileclose.png"/>
<File Name="bitmaps/[email protected]"/>
</VirtualDirectory>
</VirtualDirectory>
<VirtualDirectory Name="osx">
<File Name="Info.plist"/>
Expand Down
Binary file modified Notebook/bitmaps/chevron-down-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Notebook/bitmaps/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Notebook/bitmaps/chevron-down-grey.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Notebook/bitmaps/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Notebook/bitmaps/fileclose-dark.png
Binary file not shown.
Binary file modified Notebook/bitmaps/fileclose-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Notebook/bitmaps/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Notebook/bitmaps/fileclose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Notebook/bitmaps/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e56f66b

Please sign in to comment.