~ubuntu-branches/ubuntu/raring/codeblocks/raring-proposed

« back to all changes in this revision

Viewing changes to src/plugins/contrib/codesnippets/codesnippetstreectrl.h

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-08-09 04:38:38 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100809043838-a59ygguym4eg0jgw
Tags: 10.05-0ubuntu1
* New upstream release. Closes (LP: #322350)
 - Switch to dpkg-source 3.0 (quilt) format
 - Remove unneeded README.source
 - Add debian/get-source-orig script that removes all
   Windows prebuilt binaries
* Bump Standards-Version to 3.9.1
 - Stop shipping *.la files
* debian/control
 - Add cdbs package as Build-Depend
 - Add libbz2-dev and zlib1g-dev packages as
   Build-Depends (needed by libhelp_plugin.so)
 - Remove dpatch package of Build-Depends
 - Add codeblocks-contrib-debug package
 - Split architecture-independent files of codeblocks
   package in codeblocks-common package
* debian/rules
 - Switch to CDBS rules system
 - Add parallel build support
 - Add a call to debian/get-source-orig script
 - Use lzma compression (saves 23,5 MB of free space)
* debian/patches
 - Refresh 01_codeblocks_plugin_path
 - Add 02_no_Makefiles_in_debian_dir to remove any link
   in codeblocks build system to deleted Makefiles of debian directory
 - Drop 02_ftbfs_gcc44 and 03_ftbfs_glib221 (merged in upstream)
* debian/watch
 - Update to use the new host (berlios.de)

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#include "snippetitemdata.h"
33
33
#include <tinyxml/tinyxml.h>
34
34
#include "snippetproperty.h"
 
35
#include "codesnippetsevent.h"
 
36
#include "snippetsconfig.h"
35
37
 
36
38
//#if defined(__WXGTK__)
37
39
//    #include <X11/Xlibint.h>
41
43
//    #undef Absolute //wx Layout.h and STC conflicts
42
44
//#endif
43
45
 
44
 
WX_DEFINE_ARRAY(wxDialog*, DlgPtrArray);
 
46
WX_DEFINE_ARRAY(wxScrollingDialog*, DlgPtrArray);
45
47
//-WX_DEFINE_ARRAY(int, DlgRetcodeArray); //(stahta01 2007/4/21 for wxGTK2.8)
46
48
WX_DEFINE_ARRAY_INT(int, DlgRetcodeArray);
47
49
// ----------------------------------------------------------------------------
58
60
                bool        LoadItemsFromFile(const wxString& fileName, bool bAppendItems);
59
61
                void        LoadItemsFromXmlNode(const TiXmlElement* node, const wxTreeItemId& parentID);
60
62
                void        SaveItemsToXmlNode(TiXmlNode* node, const wxTreeItemId& parentID);
61
 
                void        AddCodeSnippet(const wxTreeItemId& parent, wxString title, wxString codeSnippet, bool editNow);
62
 
                wxTreeItemId AddCategory(const wxTreeItemId& parent, wxString title, bool editNow);
 
63
                void        AddCodeSnippet(const wxTreeItemId& parent, wxString title, wxString codeSnippet, long ID, bool editNow);
 
64
                wxTreeItemId AddCategory(const wxTreeItemId& parent, wxString title, long ID, bool editNow);
63
65
        bool        RemoveItem(const wxTreeItemId itemId);
64
66
 
65
67
        bool        SetFileChanged(bool truefalse) { return m_fileChanged = truefalse; }
66
68
        bool        GetFileChanged() { return m_fileChanged; }
67
 
        void        SaveFileModificationTime(wxDateTime savedTime = time_t(0));
 
69
        void        FetchFileModificationTime(wxDateTime savedTime = time_t(0));
68
70
        wxDateTime  GetSavedFileModificationTime(){ return m_LastXmlModifiedTime;}
69
71
        wxTreeItemId ConvertSnippetToCategory(wxTreeItemId itemId);
70
72
        void        OnItemSelected(wxTreeEvent& event);
76
78
        void        EditSnippetAsText();
77
79
        void        EditSnippetWithMIME();
78
80
 
 
81
        void SaveDataAndCloseEditorFrame();
 
82
 
79
83
        // This OnIdle() is driven from the plugin|app OnIdle routines
80
84
        void OnIdle();
81
85
 
103
107
                return itemData;
104
108
            }
105
109
 
 
110
        long GetSnippetID( wxTreeItemId itemId )
 
111
            {   wxString itemData = wxEmptyString;
 
112
                if (not itemId.IsOk()) return 0;
 
113
                SnippetItemData* pItem = (SnippetItemData*)(GetItemData(itemId));
 
114
                return pItem->GetID();
 
115
            }
 
116
 
106
117
        wxString GetSnippetLabel(wxTreeItemId treeItemId=(void*)0)
107
118
            {   wxTreeItemId itemId = treeItemId;
108
119
                if (not itemId.IsOk()) itemId = GetSelection();
125
136
                if (not IsSnippet(itemId) ) return wxEmptyString;
126
137
                wxString fileName = GetSnippet(itemId).BeforeFirst('\r');
127
138
                fileName = fileName.BeforeFirst('\n');
128
 
                #if defined(BUILDING_PLUGIN)
 
139
                //-#if defined(BUILDING_PLUGIN)
 
140
                static const wxString delim(_T("$%["));
 
141
                if( fileName.find_first_of(delim) != wxString::npos )
129
142
                    Manager::Get()->GetMacrosManager()->ReplaceMacros(fileName);
130
 
                #endif
 
143
                //-#endif
131
144
                return fileName;
132
145
            }
133
146
 
167
180
        void            SetAssociatedItemID(wxTreeItemId id){m_MnuAssociatedItemID = id;}
168
181
        bool            EditSnippetProperties(wxTreeItemId& itemId);
169
182
        void            OpenSnippetAsFileLink();
170
 
        int             ExecuteDialog(wxDialog* pdlg, wxSemaphore& waitSem);
 
183
        int             ExecuteDialog(wxScrollingDialog* pdlg, wxSemaphore& waitSem);
 
184
 
 
185
        wxTreeItemId FindTreeItemByLabel(const wxString& searchTerms, const wxTreeItemId& node, int requestType);
 
186
        wxTreeItemId FindTreeItemByTreeId(const wxTreeItemId& itemToFind, const wxTreeItemId& startNode, int itemToFindType);
 
187
        wxTreeItemId FindTreeItemBySnippetId(const SnippetItemID& IDToFind, const wxTreeItemId& startNode);
 
188
        wxTreeItemId ResetSnippetsIDs(const wxTreeItemId& startNode);
 
189
        wxTreeItemId FillFileLinksMapArray(const wxTreeItemId& startNode, FileLinksMapArray& fileLinksMapArray);
 
190
 
 
191
        // CodeSnippet/ThreadSearch events
 
192
        void OnCodeSnippetsEvent_Select(CodeSnippetsEvent& event);
 
193
        void OnCodeSnippetsEvent_Edit(CodeSnippetsEvent& event);
 
194
        void OnCodeSnippetsEvent_GetFileLinks(CodeSnippetsEvent& event);
171
195
 
172
196
        private:
173
197
 
180
204
        bool                    m_MouseCtrlKeyDown;
181
205
                wxTreeItemId            m_MnuAssociatedItemID;
182
206
                bool                    m_bMouseLeftWindow;
183
 
        wxDialog*               m_pPropertiesDialog;
 
207
        wxScrollingDialog*               m_pPropertiesDialog;
184
208
                CodeSnippetsTreeCtrl*   m_pSnippetsTreeCtrl;
185
209
                // Snippet Window Parent could be floating wxAUI window or CodeBlocks.
186
210
                wxWindow*               m_pSnippetWindowParent;
193
217
        void MSW_MouseMove(int x, int y );
194
218
       #endif
195
219
 
196
 
        wxTreeItemId FindItemByLabel(const wxString& searchTerms, const wxTreeItemId& node, int requestType);
197
 
        wxTreeItemId FindItemById(const wxTreeItemId& itemToFind, const wxTreeItemId& startNode, int itemToFindType);
198
 
 
199
220
        void EditSnippet(SnippetItemData* pSnippetItemData, wxString fileName=wxEmptyString);
200
221
 
201
222
        void OnBeginTreeItemDrag(wxTreeEvent& event);
202
223
        void OnEndTreeItemDrag(wxTreeEvent& event);
203
224
                void OnLeaveWindow(wxMouseEvent& event);
204
225
                void OnEnterWindow(wxMouseEvent& event);
205
 
        void OnMouseEvent(wxMouseEvent& event);
 
226
        void OnMouseMotionEvent(wxMouseEvent& event);
 
227
        void OnMouseWheelEvent(wxMouseEvent& event);
206
228
        void OnShutdown(wxCloseEvent& event);
207
229
        //-void OnIdle(wxIdleEvent& event);
 
230
        void CreateDirLevels(const wxString& pathNameIn);
208
231
 
209
232
                // Must use this so overridden OnCompareItems() works on MSW,
210
233
                // see wxWidgets Samples -> TreeCtrl sample