Engauge Digitizer  2
CreateToolBars.cpp
Go to the documentation of this file.
1 /******************************************************************************************************
2  * (C) 2018 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #include "CreateToolBars.h"
10 #include "DlgSettingsCoords.h"
11 #include "DlgSettingsCurveList.h"
15 #include "DlgSettingsGeneral.h"
16 #include "DlgSettingsGridDisplay.h"
17 #include "DlgSettingsGridRemoval.h"
18 #include "DlgSettingsMainWindow.h"
19 #include "DlgSettingsPointMatch.h"
20 #include "DlgSettingsSegments.h"
21 #include "Logger.h"
22 #include "MainWindow.h"
23 #include <QComboBox>
24 #include <QPushButton>
25 #include <QToolBar>
26 #include "ViewPointStyle.h"
27 #include "ViewSegmentFilter.h"
28 
30 {
31 }
32 
34 {
35  LOG4CPP_INFO_S ((*mainCat)) << "CreateToolBars::create";
36 
37  const int VIEW_SIZE = 22;
38 
39  // Background toolbar widgets
40  mw.m_cmbBackground = new QComboBox ();
41  mw.m_cmbBackground->setEnabled (false);
42  mw.m_cmbBackground->setStatusTip (tr ("Select background image"));
43  mw.m_cmbBackground->setWhatsThis (tr ("Selected Background\n\n"
44  "Select background image:\n"
45  "1) No background which highlights points\n"
46  "2) Original image which shows everything\n"
47  "3) Filtered image which highlights important details"));
48  mw.m_cmbBackground->addItem (tr ("No background"), QVariant (BACKGROUND_IMAGE_NONE));
49  mw.m_cmbBackground->addItem (tr ("Original image"), QVariant (BACKGROUND_IMAGE_ORIGINAL));
50  mw.m_cmbBackground->addItem (tr ("Filtered image"), QVariant (BACKGROUND_IMAGE_FILTERED));
51  // selectBackgroundOriginal needs currentIndexChanged
52  connect (mw.m_cmbBackground, SIGNAL (currentIndexChanged (int)), &mw, SLOT (slotCmbBackground (int)));
53 
54  // Background toolbar
55  mw.m_toolBackground = new QToolBar (tr ("Background"), &mw);
56  mw.m_toolBackground->addWidget (mw.m_cmbBackground);
57  mw.addToolBar (mw.m_toolBackground);
58 
59  // Digitize toolbar widgets that are not created elsewhere
60  mw.m_cmbCurve = new QComboBox ();
61  mw.m_cmbCurve->setEnabled (false);
62  mw.m_cmbCurve->setMinimumWidth (180);
63  mw.m_cmbCurve->setStatusTip (tr ("Select curve for new points."));
64  mw.m_cmbCurve->setWhatsThis (tr ("Selected Curve Name\n\n"
65  "Select curve for any new points. Every point belongs to one curve.\n\n"
66  "This can be changed while in Curve Point, Point Match, Color Picker or Segment Fill mode."));
67  connect (mw.m_cmbCurve, SIGNAL (activated (int)), &mw, SLOT (slotCmbCurve (int))); // activated() ignores code changes
68 
69  // Digitize toolbar
70  mw.m_toolDigitize = new QToolBar (tr ("Drawing"), &mw);
71  mw.m_toolDigitize->addAction (mw.m_actionDigitizeSelect);
72  mw.m_toolDigitize->insertSeparator (mw.m_actionDigitizeAxis);
73  mw.m_toolDigitize->addAction (mw.m_actionDigitizeAxis);
74  mw.m_toolDigitize->addAction (mw.m_actionDigitizeScale);
75  mw.m_toolDigitize->insertSeparator (mw.m_actionDigitizeCurve);
76  mw.m_toolDigitize->addAction (mw.m_actionDigitizeCurve);
77  mw.m_toolDigitize->addAction (mw.m_actionDigitizePointMatch);
78  mw.m_toolDigitize->addAction (mw.m_actionDigitizeColorPicker);
79  mw.m_toolDigitize->addAction (mw.m_actionDigitizeSegment);
80  mw.m_toolDigitize->addWidget (mw.m_cmbCurve);
81  mw.addToolBar (mw.m_toolDigitize);
82 
83  // Views toolbar widgets
84  mw.m_viewPointStyle = new ViewPointStyle();
85  mw.m_viewPointStyle->setMinimumSize(VIEW_SIZE, VIEW_SIZE);
86  mw.m_viewPointStyle->setMaximumSize(VIEW_SIZE, VIEW_SIZE);
87  mw.m_viewPointStyle->setStatusTip (tr ("Points style for the currently selected curve"));
88  mw.m_viewPointStyle->setWhatsThis (tr ("Points Style\n\n"
89  "Points style for the currently selected curve. The points style is only "
90  "displayed in this toolbar. To change the points style, "
91  "use the Curve Properties dialog."));
92 
93  mw.m_viewSegmentFilter = new ViewSegmentFilter();
94  mw.m_viewSegmentFilter->setMinimumSize(VIEW_SIZE, VIEW_SIZE);
95  mw.m_viewSegmentFilter->setMaximumSize(VIEW_SIZE, VIEW_SIZE);
96  mw.m_viewSegmentFilter->setStatusTip (tr ("View of filter for current curve in Segment Fill mode"));
97  mw.m_viewSegmentFilter->setWhatsThis (tr ("Segment Fill Filter\n\n"
98  "View of filter for the current curve in Segment Fill mode. The filter settings are only "
99  "displayed in this toolbar. To changed the filter settings, "
100  "use the Color Picker mode or the Filter Settings dialog."));
101 
102  // Settings views toolbar
103  mw.m_toolSettingsViews = new QToolBar (tr ("Views"), &mw);
104  mw.m_toolSettingsViews->addWidget (mw.m_viewPointStyle);
105  mw.m_toolSettingsViews->addWidget (new QLabel (" ")); // A hack, but this works to put some space between the adjacent widgets
106  mw.m_toolSettingsViews->addWidget (mw.m_viewSegmentFilter);
107  mw.addToolBar (mw.m_toolSettingsViews);
108 
109  // Coordinate system toolbar
110  mw.m_cmbCoordSystem = new QComboBox;
111  mw.m_cmbCoordSystem->setEnabled (false);
112  mw.m_cmbCoordSystem->setStatusTip (tr ("Currently selected coordinate system"));
113  mw.m_cmbCoordSystem->setWhatsThis (tr ("Selected Coordinate System\n\n"
114  "Currently selected coordinate system. This is used to switch between coordinate systems "
115  "in documents with multiple coordinate systems"));
116  connect (mw.m_cmbCoordSystem, SIGNAL (activated (int)), &mw, SLOT (slotCmbCoordSystem (int)));
117 
118  mw.m_btnShowAll = new QPushButton(QIcon(":/engauge/img/icon_show_all.png"), "");
119  mw.m_btnShowAll->setEnabled (false);
120  mw.m_btnShowAll->setAcceptDrops(false);
121  mw.m_btnShowAll->setStatusTip (tr ("Show all coordinate systems"));
122  mw.m_btnShowAll->setWhatsThis (tr ("Show All Coordinate Systems\n\n"
123  "When pressed and held, this button shows all digitized points and lines for all coordinate systems."));
124  connect (mw.m_btnShowAll, SIGNAL (pressed ()), &mw, SLOT (slotBtnShowAllPressed ()));
125  connect (mw.m_btnShowAll, SIGNAL (released ()), &mw, SLOT (slotBtnShowAllReleased ()));
126 
127  mw.m_btnPrintAll = new QPushButton(QIcon(":/engauge/img/icon_print_all.png"), "");
128  mw.m_btnPrintAll->setEnabled (false);
129  mw.m_btnPrintAll->setAcceptDrops(false);
130  mw.m_btnPrintAll->setStatusTip (tr ("Print all coordinate systems"));
131  mw.m_btnPrintAll->setWhatsThis (tr ("Print All Coordinate Systems\n\n"
132  "When pressed, this button Prints all digitized points and lines for all coordinate systems."));
133  connect (mw.m_btnPrintAll, SIGNAL (pressed ()), &mw, SLOT (slotBtnPrintAll ()));
134 
135  mw.m_toolCoordSystem = new QToolBar (tr ("Coordinate System"), &mw);
136  mw.m_toolCoordSystem->addWidget (mw.m_cmbCoordSystem);
137  mw.m_toolCoordSystem->addWidget (mw.m_btnShowAll);
138  mw.m_toolCoordSystem->addWidget (mw.m_btnPrintAll);
139  mw.addToolBar (mw.m_toolCoordSystem);
140 }
141 
Class that displays the current Segment Filter in a MainWindow toolbar.
void create(MainWindow &mw)
Create QToolbar toolbars.
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
Class that displays a view of the current Curve&#39;s point style.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
CreateToolBars()
Single constructor.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition: MainWindow.h:91