-
Notifications
You must be signed in to change notification settings - Fork 156
/
TemplateFrame.h
160 lines (147 loc) · 6.46 KB
/
TemplateFrame.h
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/**
* GeoDa TM, Copyright (C) 2011-2015 by Luc Anselin - all rights reserved
*
* This file is part of GeoDa.
*
* GeoDa is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GeoDa is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GEODA_CENTER_TEMPLATE_FRAME_H__
#define __GEODA_CENTER_TEMPLATE_FRAME_H__
#include <set>
#include <wx/frame.h>
#include "FramesManagerObserver.h"
#include "DataViewer/TableStateObserver.h"
#include "DataViewer/TimeStateObserver.h"
class FramesManager;
class TableState;
class TimeState;
class Project;
class TemplateCanvas;
class TemplateLegend;
/**
* Common template frame
*/
class TemplateFrame: public wxFrame, public FramesManagerObserver,
public TableStateObserver, public TimeStateObserver
{
public:
TemplateFrame(wxFrame *parent, Project* project, const wxString& title,
const wxPoint& pos, const wxSize& size, const long style);
virtual ~TemplateFrame();
static wxString GetActiveName();
static TemplateFrame* GetActiveFrame();
static bool GetColorFromUser(wxWindow* parent,
const wxColour& cur_color,
wxColour& ret_color,
const wxString& title = _("Choose A Color"));
void OnKeyEvent(wxKeyEvent& event);
void DeregisterAsActive();
void RegisterAsActive(const wxString& name,
const wxString& title = "GeoDa");
virtual void MapMenus();
virtual void OnActivate(wxActivateEvent& event) {}
virtual void ExportImage(TemplateCanvas* canvas, const wxString& type);
virtual void OnChangeMapTransparency();
virtual void OnSaveCanvasImageAs(wxCommandEvent& event);
virtual void OnCopyLegendToClipboard(wxCommandEvent& event);
virtual void OnCopyImageToClipboard(wxCommandEvent& event);
virtual void OnLegendUseScientificNotation(wxCommandEvent& event);
virtual void OnLegendDisplayPrecision(wxCommandEvent& event);
virtual void OnLegendBackgroundColor(wxCommandEvent& event);
virtual void OnCanvasBackgroundColor(wxCommandEvent& event);
virtual void OnSelectableFillColor(wxCommandEvent& event);
virtual void OnSelectableOutlineColor(wxCommandEvent& event);
virtual void OnUserBackgroundColorVisible(wxCommandEvent& event);
virtual void OnSelectableOutlineVisible(wxCommandEvent& event);
virtual void OnHighlightColor(wxCommandEvent& event);
virtual void OnSelectWithRect(wxCommandEvent& event);
virtual void OnSelectWithCircle(wxCommandEvent& event);
virtual void OnSelectWithLine(wxCommandEvent& event);
virtual void OnSelectWithCustom(wxCommandEvent& event);
virtual void OnSelectionMode(wxCommandEvent& event);
virtual void OnResetMap(wxCommandEvent& event);
virtual void OnRefreshMap(wxCommandEvent& event);
virtual void OnFitToWindowMode(wxCommandEvent& event);
virtual void OnFixedAspectRatioMode(wxCommandEvent& event);
virtual void OnSetAxisDisplayPrecision(wxCommandEvent& event);
virtual void OnDisplayPrecision(wxCommandEvent& event);
virtual void OnZoomMode(wxCommandEvent& event);
virtual void OnZoomOutMode(wxCommandEvent& event);
virtual void OnPanMode(wxCommandEvent& event);
virtual void OnPrintCanvasState(wxCommandEvent& event);
virtual void UpdateOptionMenuItems();
virtual void UpdateContextMenuItems(wxMenu* menu);
virtual void UpdateTitle();
virtual void OnTimeSyncVariable(int var_index);
virtual void OnFixedScaleVariable(int var_index);
virtual void OnPlotsPerView(int plots_per_view);
virtual void OnPlotsPerViewOther();
virtual void OnPlotsPerViewAll();
virtual bool IsStatusBarVisible();
virtual void OnDisplayStatusBar(wxCommandEvent& event);
virtual void DisplayStatusBar(bool show);
/** Called by TemplateCanvas to determine if TemplateFrame will
generate the Status Bar String. */
virtual bool GetStatusBarStringFromFrame();
/** Set to true if TemplateFrame implements GetUpdateStatusBarString. */
virtual void SetGetStatusBarStringFromFrame(bool get_sb_string);
virtual wxString GetUpdateStatusBarString(const std::vector<int>& hover_obs,
int total_hover_obs);
virtual Project* GetProject();
/** return value can be null */
virtual TemplateLegend* GetTemplateLegend();
/** Default Implementation of FramesManagerObserver interface */
virtual void update(FramesManager* o);
/** Default Implementation of TableStateObserver interface */
virtual void update(TableState* o);
/** Default Implementation of TimeStateObserver interface */
virtual void update(TimeState* o);
/** Default Implementation of TableStateObserver interface. Indicates if
frame currently handle changes to time-line. This is a function
of private boolean variables depends_on_non_simple_groups
and supports_timeline_changes. If supports_timeline_changes is true,
then return value is true and depends_on_non_simple_groups is ignored. */
virtual bool AllowTimelineChanges();
virtual bool AllowGroupModify(const wxString& grp_nm);
virtual bool AllowObservationAddDelete();
/** Indicate that current view depends on group */
virtual void AddGroupDependancy(const wxString& grp_nm);
/** Indicate that current view no longer depends on group */
virtual void RemoveGroupDependancy(const wxString& grp_nm);
virtual void ClearAllGroupDependencies();
virtual void SetDependsOnNonSimpleGroups(bool v);
virtual int GetCurrentCanvasTimeStep();
TemplateCanvas* template_canvas;
protected:
static TemplateFrame* activeFrame;
static wxString activeFrName;
wxToolBar* toolbar;
Project* project;
TemplateLegend* template_legend; // optional
FramesManager* frames_manager;
TableState* table_state;
TimeState* time_state;
bool is_status_bar_visible;
bool get_status_bar_string_from_frame;
/** True iff frame depend on multi-time-period variables currently.
If supports_timeline_changes is true, then no need to update this
variable. */
bool depends_on_non_simple_groups;
/** True iff frame can handle time-line changes such as add/delete/swap. */
bool supports_timeline_changes;
std::set<wxString> grp_dependencies;
DECLARE_CLASS(TemplateFrame)
DECLARE_EVENT_TABLE()
};
#endif