From: Eran I. <no...@so...> - 2014-01-10 22:54:28
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "codelite". The branch, master has been updated via dc02d280645d63f4bc52b84aad2cf8c547dbad4c (commit) from bc5687e8d33054008f9bd28f070ded6ecf80ad2b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://sourceforge.net/p/codelite/codelitegit/ci/dc02d280645d63f4bc52b84aad2cf8c547dbad4c commit dc02d280645d63f4bc52b84aad2cf8c547dbad4c Author: Eran <era...@gm...> Date: Sat Jan 11 00:54:12 2014 +0200 CMakePlugin / wxCrafter: use icon for the tabs diff --git a/CMakePlugin/CMakePlugin.cpp b/CMakePlugin/CMakePlugin.cpp index 81d509b..e3bee9b 100644 --- a/CMakePlugin/CMakePlugin.cpp +++ b/CMakePlugin/CMakePlugin.cpp @@ -193,11 +193,14 @@ CMakePlugin::CMakePlugin(IManager* manager) m_cmake.reset(new CMake(m_configuration->GetProgramPath())); Notebook* book = m_mgr->GetWorkspacePaneNotebook(); + cmakeImages images; + const wxBitmap &bmp = images.Bitmap("cmake_16"); if (IsPaneDetached()) { - DockablePane* cp = new DockablePane(book->GetParent()->GetParent(), book, HELP_TAB_NAME, wxNullBitmap, wxSize(200, 200)); + DockablePane* cp = new DockablePane(book->GetParent()->GetParent(), book, HELP_TAB_NAME, bmp, wxSize(200, 200)); cp->SetChildNoReparent(new CMakeHelpTab(cp, this)); + } else { - book->AddPage(new CMakeHelpTab(book, this), HELP_TAB_NAME, false); + book->AddPage(new CMakeHelpTab(book, this), HELP_TAB_NAME, false, bmp); } // Bind events diff --git a/CMakePlugin/CMakePlugin.wxcp b/CMakePlugin/CMakePlugin.wxcp index bd40109..1813074 100644 --- a/CMakePlugin/CMakePlugin.wxcp +++ b/CMakePlugin/CMakePlugin.wxcp @@ -1,7 +1,7 @@ { "metadata": { "m_generatedFilesDir": ".", - "m_objCounter": 225, + "m_objCounter": 227, "m_includeFiles": [], "m_bitmapFunction": "wxCrafterR3nJ3cInitBitmapResources", "m_bitmapsFile": "CMakePluginUi_bitmaps.cpp", @@ -3050,5 +3050,59 @@ "m_children": [] }] }] + }, { + "m_type": 4481, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "string", + "m_label": "Name:", + "m_value": "cmakeImages" + }, { + "type": "string", + "m_label": "File:", + "m_value": "" + }, { + "type": "virtualFolderPicker", + "m_label": "Virtual Folder:", + "m_path": "CMakePlugin:wxcrafter" + }, { + "type": "string", + "m_label": "Class Decorator", + "m_value": "" + }, { + "type": "integer", + "m_label": "Bitmap Size:", + "m_value": 16 + }, { + "type": "bool", + "m_label": "Bitmap Mask", + "m_value": true + }], + "m_events": [], + "m_children": [{ + "m_type": 4482, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "string", + "m_label": "Name:", + "m_value": "cmake_16" + }, { + "type": "filePicker", + "m_label": "Bitmap File:", + "m_path": "cmake-16.png" + }], + "m_events": [], + "m_children": [] + }] }] } \ No newline at end of file diff --git a/CMakePlugin/CMakePluginUi.cpp b/CMakePlugin/CMakePluginUi.cpp index d13f9bd..d11f7c0 100644 --- a/CMakePlugin/CMakePluginUi.cpp +++ b/CMakePlugin/CMakePluginUi.cpp @@ -343,3 +343,28 @@ CMakeProjectSettingsPanelBase::~CMakeProjectSettingsPanelBase() m_textCtrlArguments->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(CMakeProjectSettingsPanelBase::OnCheck2), NULL, this); } + +cmakeImages::cmakeImages() + : wxImageList(16, 16, true) +{ + if ( !bBitmapLoaded ) { + // We need to initialise the default bitmap handler + wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler); + wxCrafterR3nJ3cInitBitmapResources(); + bBitmapLoaded = true; + } + + { + wxBitmap bmp; + wxIcon icn; + bmp = wxXmlResource::Get()->LoadBitmap(wxT("cmake_16")); + icn.CopyFromBitmap( bmp ); + this->Add( icn ); + m_bitmaps.insert( std::make_pair(wxT("cmake_16"), bmp ) ); + } + +} + +cmakeImages::~cmakeImages() +{ +} diff --git a/CMakePlugin/CMakePluginUi.h b/CMakePlugin/CMakePluginUi.h index bf942ac..b29c811 100644 --- a/CMakePlugin/CMakePluginUi.h +++ b/CMakePlugin/CMakePluginUi.h @@ -28,6 +28,10 @@ #include <wx/checkbox.h> #include <wx/combobox.h> #include <wx/textctrl.h> +#include <wx/imaglist.h> +#include <wx/bitmap.h> +#include <map> +#include <wx/icon.h> class CMakeSettingsDialogBase : public wxDialog { @@ -106,4 +110,24 @@ public: virtual ~CMakeProjectSettingsPanelBase(); }; + +class cmakeImages : public wxImageList +{ +protected: + // Maintain a map of all bitmaps representd by their name + std::map<wxString, wxBitmap> m_bitmaps; + + +protected: + +public: + cmakeImages(); + const wxBitmap& Bitmap(const wxString &name) const { + if ( !m_bitmaps.count(name) ) + return wxNullBitmap; + return m_bitmaps.find(name)->second; + } + virtual ~cmakeImages(); +}; + #endif diff --git a/CMakePlugin/CMakePluginUi_bitmaps.cpp b/CMakePlugin/CMakePluginUi_bitmaps.cpp index 0302b40..3e8c72f 100644 --- a/CMakePlugin/CMakePluginUi_bitmaps.cpp +++ b/CMakePlugin/CMakePluginUi_bitmaps.cpp @@ -21,14 +21,63 @@ wxMemoryFSHandler::AddFile(name, data, size) #endif -static size_t xml_res_size_0 = 108; +static size_t xml_res_size_0 = 843; static unsigned char xml_res_file_0[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, +0,31,243,255,97,0,0,0,6,98,75,71,68,0,255,0,255,0,255,160,189,167,147,0, +0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24,0,0,0,7,116,73,77, +69,7,222,1,10,22,14,18,195,172,157,47,0,0,2,216,73,68,65,84,56,203,125, +144,75,108,84,101,24,134,159,255,220,254,115,254,115,198,206,12,51,211, +153,78,47,12,157,38,69,211,146,64,48,81,23,85,49,66,21,52,40,27,48,129, +138,1,12,154,24,22,44,88,145,176,195,181,59,23,134,141,75,55,174,140,18, +13,11,119,82,140,81,161,244,66,112,72,40,244,54,215,83,206,233,204,239, +98,90,23,84,248,86,223,226,251,158,231,205,107,242,156,57,248,234,251,111, +103,131,212,27,149,165,202,12,16,121,192,198,83,55,198,211,79,59,118,244, +110,173,78,161,252,250,123,227,217,242,213,227,176,31,32,252,31,201,54, +192,242,242,34,0,231,63,251,242,181,142,59,240,110,106,221,72,231,18,206, +59,128,2,240,132,120,54,32,157,254,207,238,233,206,224,33,219,218,181,211, +213,30,10,227,248,4,236,5,8,181,126,54,96,101,165,107,159,154,186,178,183, +211,73,159,168,213,122,88,119,2,61,100,203,226,176,101,30,6,124,0,101,24, +219,1,91,246,209,81,95,69,81,254,112,28,23,250,91,205,142,142,172,128,188, +84,12,73,249,241,91,82,190,4,208,234,116,182,3,182,236,99,99,23,94,52,205, +190,211,139,139,14,237,88,211,18,190,136,165,210,227,74,229,6,165,252,80, +24,134,2,240,55,83,24,221,230,243,0,76,78,78,168,56,206,30,107,52,138,185, +122,125,93,71,145,22,117,146,196,118,130,33,229,177,91,169,51,7,148,26, +1,104,110,166,48,186,205,63,4,32,138,198,202,182,189,243,92,165,98,16,69, +176,186,178,74,216,169,35,19,190,48,29,169,95,238,233,73,13,120,222,169, +146,235,74,128,192,52,49,210,233,174,253,228,201,115,210,117,251,78,45, +45,229,146,97,24,233,106,245,177,200,229,254,102,226,128,36,91,72,98,58, +14,253,65,192,43,169,212,217,130,227,12,3,52,218,109,204,48,108,0,160,245, +224,72,38,243,230,215,243,243,190,29,71,143,25,222,53,35,78,124,148,99, +160,232,17,204,206,147,168,86,133,229,56,186,207,247,157,153,48,100,36, +8,126,248,179,209,208,6,192,197,139,95,89,197,226,248,249,202,63,105,213, +108,220,215,131,165,95,197,145,67,30,41,207,226,209,90,131,13,199,198,85, +10,219,113,232,245,125,14,230,243,103,110,86,171,195,0,38,192,194,194,98, +169,144,63,122,237,206,237,71,70,241,232,143,212,46,223,16,127,245,222, +98,245,193,10,205,133,13,70,151,90,12,196,33,134,101,10,211,178,244,80, +16,88,179,205,166,55,93,173,126,111,106,173,185,254,211,253,171,119,239, +138,253,253,159,92,215,149,47,110,136,57,57,203,3,235,33,183,51,51,204, +246,205,177,28,173,97,222,107,83,220,240,232,113,37,129,43,133,180,237, +61,223,85,42,223,138,212,11,133,210,232,216,167,115,242,244,180,184,53, +249,139,94,107,175,9,34,224,9,16,1,45,176,234,6,201,102,130,221,119,50, +28,249,61,195,7,181,172,46,41,95,124,62,253,219,53,81,222,119,236,155,236, +165,250,212,205,145,159,121,18,71,208,222,124,140,128,245,46,128,214,230, +30,131,107,72,242,181,148,158,152,75,138,242,31,78,252,47,183,191,5,89, +119,238,104,246,0,0,0,0,73,69,78,68,174,66,96,130}; + +static size_t xml_res_size_1 = 210; +static unsigned char xml_res_file_1[] = { 60,63,120,109,108,32,118,101,114,115,105,111,110,61,34,49,46,48,34,32,101, 110,99,111,100,105,110,103,61,34,85,84,70,45,56,34,63,62,10,60,114,101, 115,111,117,114,99,101,32,120,109,108,110,115,61,34,104,116,116,112,58, 47,47,119,119,119,46,119,120,119,105,110,100,111,119,115,46,111,114,103, 47,119,120,120,114,99,34,32,118,101,114,115,105,111,110,61,34,50,46,51, -46,48,46,49,34,47,62,10}; +46,48,46,49,34,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115, +61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,99,109,97, +107,101,95,49,54,34,62,67,77,97,107,101,80,108,117,103,105,110,85,105,95, +98,105,116,109,97,112,115,46,99,112,112,36,99,109,97,107,101,45,49,54,46, +112,110,103,60,47,111,98,106,101,99,116,62,10,60,47,114,101,115,111,117, +114,99,101,62,10}; void wxCrafterR3nJ3cInitBitmapResources() { @@ -43,6 +92,7 @@ void wxCrafterR3nJ3cInitBitmapResources() else wxFileSystem::AddHandler(new wxMemoryFSHandlerBase); } - XRC_ADD_FILE(wxT("XRC_resource/CMakePluginUi_bitmaps.cpp$C__src_codelitegit_CMakePlugin_CMakePluginUi_bitmaps.xrc"), xml_res_file_0, xml_res_size_0, wxT("text/xml")); + XRC_ADD_FILE(wxT("XRC_resource/CMakePluginUi_bitmaps.cpp$cmake-16.png"), xml_res_file_0, xml_res_size_0, wxT("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/CMakePluginUi_bitmaps.cpp$C__src_codelitegit_CMakePlugin_CMakePluginUi_bitmaps.xrc"), xml_res_file_1, xml_res_size_1, wxT("text/xml")); wxXmlResource::Get()->Load(wxT("memory:XRC_resource/CMakePluginUi_bitmaps.cpp$C__src_codelitegit_CMakePlugin_CMakePluginUi_bitmaps.xrc")); } diff --git a/CMakePlugin/cmake-16.png b/CMakePlugin/cmake-16.png new file mode 100644 index 0000000..caa0c32 Binary files /dev/null and b/CMakePlugin/cmake-16.png differ diff --git a/LiteEditor/mainbook.cpp b/LiteEditor/mainbook.cpp index a4c28d4..46a47b6 100644 --- a/LiteEditor/mainbook.cpp +++ b/LiteEditor/mainbook.cpp @@ -598,7 +598,7 @@ bool MainBook::AddPage(wxWindow *win, const wxString &text, const wxBitmap &bmp, // the selection programtically int next_pos = m_book->GetPageCount(); #endif - m_book->AddPage(win, text, closeLastTab ? true : selected); + m_book->AddPage(win, text, closeLastTab ? true : selected, bmp); #if CL_USE_NATIVEBOOK // If the newly added page is expected to be the selected one @@ -614,7 +614,7 @@ bool MainBook::AddPage(wxWindow *win, const wxString &text, const wxBitmap &bmp, } #endif } else { - m_book->InsertPage(insert_at_index, win, text, closeLastTab ? true : selected); + m_book->InsertPage(insert_at_index, win, text, closeLastTab ? true : selected, bmp); } if( closeLastTab ) { diff --git a/LiteEditor/workspace_pane.cpp b/LiteEditor/workspace_pane.cpp index cd27b5c..588e74b 100644 --- a/LiteEditor/workspace_pane.cpp +++ b/LiteEditor/workspace_pane.cpp @@ -192,11 +192,16 @@ void WorkspacePane::UpdateTabs() DoShowTab(flags & View_Show_Tabs_Tab, _("Tabs")); DoShowTab(flags & View_Show_Tabgroups_Tab, _("Tabgroups")); } +typedef struct { + wxString text; + wxWindow* win; + wxBitmap bmp; +} tagTabInfo; #include "file_logger.h" void WorkspacePane::ApplySavedTabOrder() const { - typedef std::pair<wxString, wxWindow*> spTab; + wxArrayString tabs; int index = -1; @@ -206,7 +211,7 @@ void WorkspacePane::ApplySavedTabOrder() const // There are (currently) 4 'standard' panes and a variable number of plugin ones // NB Since we're only dealing with panes currently in the notebook, this shouldn't // be broken by floating panes or non-loaded plugins - std::vector<spTab> vTempstore; + std::vector<tagTabInfo> vTempstore; for (size_t t=0; t < tabs.GetCount(); ++t) { wxString title = tabs.Item(t); if (title.empty()) { @@ -214,7 +219,11 @@ void WorkspacePane::ApplySavedTabOrder() const } for (size_t n=0; n < m_book->GetPageCount(); ++n) { if (title == m_book->GetPageText(n)) { - spTab Tab(title, m_book->GetPage(n)); + tagTabInfo Tab; + Tab.text = title; + Tab.win = m_book->GetPage(n); + Tab.bmp = m_book->GetPageBitmap(n); + vTempstore.push_back(Tab); m_book->RemovePage(n); break; @@ -226,7 +235,7 @@ void WorkspacePane::ApplySavedTabOrder() const // All the matched tabs are now stored in the vector. Any left in m_book are presumably new additions // Now prepend the ordered tabs, so that any additions will effectively be appended for (size_t n=0; n < vTempstore.size(); ++n) { - m_book->InsertPage(n, vTempstore.at(n).second, vTempstore.at(n).first); + m_book->InsertPage(n, vTempstore.at(n).win, vTempstore.at(n).text, false, vTempstore.at(n).bmp); } //wxPrintf("After load");for (size_t n=0; n < m_book->GetPageCount(); ++n) CL_DEBUG1(wxString::Format("Tab %i: %zs",(int)n,m_book->GetPageText(n))); diff --git a/Plugin/cl_aui_notebook_art.cpp b/Plugin/cl_aui_notebook_art.cpp index 50a5a22..a5860d3 100644 --- a/Plugin/cl_aui_notebook_art.cpp +++ b/Plugin/cl_aui_notebook_art.cpp @@ -143,7 +143,7 @@ void clAuiGlossyTabArt::DrawTab(wxDC& dc, #endif /// the tab start position (x) - curx = rr.x + 8; + curx = rr.x + 7; // Set clipping region int clip_width = rr.width; @@ -153,7 +153,7 @@ void clAuiGlossyTabArt::DrawTab(wxDC& dc, // since the above code above doesn't play well with WXDFB or WXCOCOA, // we'll just use a rectangle for the clipping region for now -- gdc.SetClippingRegion(rr.x, rr.y, clip_width, rr.height); - path.AddRoundedRectangle(rr.x, rr.y, rr.width-1, rr.height, 6.0); + path.AddRoundedRectangle(rr.x, rr.y, rr.width-1, rr.height, 3.0); gdc.SetBrush( bgColour ); gdc.GetGraphicsContext()->FillPath( path ); @@ -164,12 +164,8 @@ void clAuiGlossyTabArt::DrawTab(wxDC& dc, gdc.SetPen(originalPenColour); gdc.DrawLine(in_rect.GetBottomLeft(), in_rect.GetBottomRight()); - } else { - // gdc.SetPen(bgColour); - // gdc.DrawLine(in_rect.GetBottomLeft(), in_rect.GetBottomRight()); } - /// Draw the text wxString caption = page.caption; if ( caption.IsEmpty() ) { caption = "Tp"; @@ -184,23 +180,24 @@ void clAuiGlossyTabArt::DrawTab(wxDC& dc, if ( caption == "Tp" ) caption.Clear(); - gdc.SetTextForeground( textColour ); - gdc.GetGraphicsContext()->DrawText( page.caption, rr.x + 8, (rr.y + (rr.height - ext.y)/2)-TAB_Y_OFFSET+TEXT_Y_SPACER); - - // advance the X offset - curx += ext.x; - /// Draw the bitmap if ( page.bitmap.IsOk() ) { - curx += 4; int bmpy = (rr.y + (rr.height - page.bitmap.GetHeight())/2)-TAB_Y_OFFSET; gdc.GetGraphicsContext()->DrawBitmap( page.bitmap, curx, bmpy, page.bitmap.GetWidth(), page.bitmap.GetHeight()); - curx += 8; + curx += page.bitmap.GetWidth(); + curx += 3; } + /// Draw the text + gdc.SetTextForeground( textColour ); + gdc.GetGraphicsContext()->DrawText( page.caption, curx, (rr.y + (rr.height - ext.y)/2)-TAB_Y_OFFSET+TEXT_Y_SPACER); + + // advance the X offset + curx += ext.x; + curx += 3; + /// Draw the X button on the tab if ( close_button_state != wxAUI_BUTTON_STATE_HIDDEN ) { - curx += 4; int btny = (rr.y + (rr.height/2))-TAB_Y_OFFSET+TEXT_Y_SPACER; if ( close_button_state == wxAUI_BUTTON_STATE_PRESSED ) { curx += 1; @@ -264,19 +261,22 @@ wxSize clAuiGlossyTabArt::GetTabSize(wxDC& dc, // add padding around the text wxCoord tab_width = measured_textx; wxCoord tab_height = measured_texty; - + + if ( tab_height < 16 ) + tab_height = 16; + // if the close button is showing, add space for it if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN) tab_width += X_DIAMETER + 3; // if there's a bitmap, add space for it + + // NOTE: we only support 16 pixels bitmap (or smaller) + // so there is no need to adjust the tab height! + tab_height += TAB_HEIGHT_SPACER; if (bitmap.IsOk()) { tab_width += bitmap.GetWidth(); tab_width += 3; // right side bitmap padding - tab_height = wxMax(tab_height, bitmap.GetHeight()); - tab_height += TAB_HEIGHT_SPACER; - } else { - tab_height += TAB_HEIGHT_SPACER; } // add padding diff --git a/TODO.TXT b/TODO.TXT index 6e8f147..d80b88d 100644 --- a/TODO.TXT +++ b/TODO.TXT @@ -1,3 +1,3 @@ - wxCrafter: make sure that after code generation an event is sent to git/svn views are updated accordingly -- CMakePlugin / wxCrafter: use icon for the tabs? - Add events for all debugger UI actions so plugins code implement it instead of the default debugger +- Allow multiple file open in open-resource dialog ----------------------------------------------------------------------- Summary of changes: CMakePlugin/CMakePlugin.cpp | 7 +++- CMakePlugin/CMakePlugin.wxcp | 56 ++++++++++++++++++++++++++++++++- CMakePlugin/CMakePluginUi.cpp | 25 ++++++++++++++ CMakePlugin/CMakePluginUi.h | 24 ++++++++++++++ CMakePlugin/CMakePluginUi_bitmaps.cpp | 56 +++++++++++++++++++++++++++++++-- CMakePlugin/cmake-16.png | Bin 0 -> 843 bytes LiteEditor/mainbook.cpp | 4 +- LiteEditor/workspace_pane.cpp | 17 +++++++-- Plugin/cl_aui_notebook_art.cpp | 40 ++++++++++++------------ TODO.TXT | 2 +- 10 files changed, 198 insertions(+), 33 deletions(-) create mode 100644 CMakePlugin/cmake-16.png hooks/post-receive -- codelite |