-
Notifications
You must be signed in to change notification settings - Fork 0
/
finfowindow.cpp
81 lines (69 loc) · 2.64 KB
/
finfowindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* This file is part of the FortranProject plugin for Code::Blocks IDE
* and licensed under the GNU General Public License, version 3
* http://www.gnu.org/licenses/gpl-3.0.html
*
* Author: Darius Markauskas
*
*/
#include "finfowindow.h"
#include <manager.h>
#include "cbeditor.h"
#include "editorcolourset.h"
#include <wx/sizer.h>
FInfoWindow::FInfoWindow()
:wxPanel(Manager::Get()->GetAppWindow())
{
//ctor
m_pView = new cbStyledTextCtrl(this, wxID_ANY, wxDefaultPosition, wxSize(1,1));
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
sizer->Add(m_pView, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 0);
SetSizer(sizer);
sizer->Fit(this);
sizer->SetSizeHints(this);
m_pView->SetReadOnly(true);
// Colorize
cbEditor::ApplyStyles(m_pView);
EditorColourSet edColSet;
edColSet.Apply(edColSet.GetLanguageForFilename(_T("name.f90")), m_pView);
SetFoldingIndicator();
CodeBlocksLogEvent evtAdd(cbEVT_ADD_LOG_WINDOW, this, _("Fortran info"));
Manager::Get()->ProcessEvent(evtAdd);
}
FInfoWindow::~FInfoWindow()
{
//dtor
}
void FInfoWindow::RemoveFromNotebook()
{
if(Manager::Get()->GetLogManager())
{
CodeBlocksLogEvent evt(cbEVT_REMOVE_LOG_WINDOW, this);
Manager::Get()->ProcessEvent(evt);
}
}
void FInfoWindow::WriteToInfoWindow(const wxString& text)
{
m_pView->Enable(false);
m_pView->SetReadOnly(false);
m_pView->SetText(text);
m_pView->SetReadOnly(true);
m_pView->Enable(true);
}
void FInfoWindow::SetMarkerStyle(int marker, int markerType, wxColor fore, wxColor back)
{
m_pView->MarkerDefine(marker, markerType);
m_pView->MarkerSetForeground(marker, fore);
m_pView->MarkerSetBackground(marker, back);
}
void FInfoWindow::SetFoldingIndicator()
{
//simple style
SetMarkerStyle(wxSCI_MARKNUM_FOLDEROPEN, wxSCI_MARK_MINUS, wxColor(0xff, 0xff, 0xff), wxColor(0x80, 0x80, 0x80));
SetMarkerStyle(wxSCI_MARKNUM_FOLDER, wxSCI_MARK_PLUS, wxColor(0xff, 0xff, 0xff), wxColor(0x80, 0x80, 0x80));
SetMarkerStyle(wxSCI_MARKNUM_FOLDERSUB, wxSCI_MARK_BACKGROUND, wxColor(0xff, 0xff, 0xff), wxColor(0x80, 0x80, 0x80));
SetMarkerStyle(wxSCI_MARKNUM_FOLDERTAIL, wxSCI_MARK_BACKGROUND, wxColor(0xff, 0xff, 0xff), wxColor(0x80, 0x80, 0x80));
SetMarkerStyle(wxSCI_MARKNUM_FOLDEREND, wxSCI_MARK_PLUS, wxColor(0xff, 0xff, 0xff), wxColor(0x80, 0x80, 0x80));
SetMarkerStyle(wxSCI_MARKNUM_FOLDEROPENMID, wxSCI_MARK_MINUS, wxColor(0xff, 0xff, 0xff), wxColor(0x80, 0x80, 0x80));
SetMarkerStyle(wxSCI_MARKNUM_FOLDERMIDTAIL, wxSCI_MARK_BACKGROUND, wxColor(0xff, 0xff, 0xff), wxColor(0x80, 0x80, 0x80));
}