Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
notes.h
1/*
2** Copyright 2007-2024, RTE (https://www.rte-france.com)
3** See AUTHORS.txt
4** SPDX-License-Identifier: MPL-2.0
5** This file is part of Antares-Simulator,
6** Adequacy and Performance assessment for interconnected energy networks.
7**
8** Antares_Simulator is free software: you can redistribute it and/or modify
9** it under the terms of the Mozilla Public Licence 2.0 as published by
10** the Mozilla Foundation, either version 2 of the License, or
11** (at your option) any later version.
12**
13** Antares_Simulator is distributed in the hope that it will be useful,
14** but WITHOUT ANY WARRANTY; without even the implied warranty of
15** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16** Mozilla Public Licence 2.0 for more details.
17**
18** You should have received a copy of the Mozilla Public Licence 2.0
19** along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20*/
21#ifndef __ANTARES_APPLICATION_WINDOWS_NOTES_H__
22#define __ANTARES_APPLICATION_WINDOWS_NOTES_H__
23
24#include <ui/common/component/panel.h>
25#include <wx/richtext/richtextctrl.h>
26#include <wx/richtext/richtextstyles.h>
27
28namespace Antares
29{
30namespace Window
31{
35class Notes final : public Antares::Component::Panel, public Yuni::IEventObserver<Notes>
36{
37public:
38 enum IDs
39 {
40 mnIDUserNotes = wxID_HIGHEST + 1,
41 };
42
46 static Yuni::Event<void(Notes* sender)> OnChanged;
47
48public:
49 // \name Constructors & Destructor
51
54 Notes(wxWindow* parent, uint margin = 18);
56 virtual ~Notes();
58
62 void saveToStudy();
63
67 void loadFromStudy();
68
73
78
79private:
80 void onBold(void*);
81 void onItalic(void*);
82 void onUnderline(void*);
83
84 void onAlignLeft(void*);
85 void onAlignRight(void*);
86 void onAlignCenter(void*);
87
88 void onListBullet(void*);
89 void onListNumbered(void*);
90
91 void onIndentIncrease(void*);
92 void onIndentDecrease(void*);
93
94 void appendStyles();
95
96 void onUserNotesCharacter(wxRichTextEvent& evt);
97 void onUserNotesStyleChanged(wxRichTextEvent& evt);
98
99 void onNotesModified(Notes* sender);
100
101 void notifyChanges();
102
103 void onStudyClosed();
104
112 bool initializeTemporaryFile();
113
114private:
116 wxRichTextCtrl* pRichEdit;
117 wxRichTextStyleSheet* pStyleSheet;
118 uint pLocalRevision;
119 uint pUpdatesToSkip;
120
127 YString pTempFile;
128
129 // Event Table
130 DECLARE_EVENT_TABLE()
131
132}; // class Notes
133
134} // namespace Window
135} // namespace Antares
136
137#endif // __ANTARES_APPLICATION_WINDOWS_NOTES_H__
Panel implementation.
Definition panel.h:36
Save As Dialog
Definition notes.h:36
void saveToStudy()
Save the comments to the study.
Definition notes.cpp:357
Notes(wxWindow *parent, uint margin=18)
Constructor with a parent window and a study.
Definition notes.cpp:60
static Yuni::Event< void(Notes *sender)> OnChanged
Event triggered when the user notes are changed.
Definition notes.h:46
virtual ~Notes()
Destructor.
Definition notes.cpp:145
void connectToNotification()
Connect to the notification of user notes updates.
Definition notes.cpp:380
void loadFromStudy()
Load the comments from the study.
Definition notes.cpp:391
void disconnectFromNotification()
Disconnect from the notifications of the user notes updates.
Definition notes.cpp:386