31#include "wx/aboutdlg.h"
33#include "wx/cmdline.h"
35#include "wx/dcmirror.h"
37#include "wx/filename.h"
47#ifndef wxHAS_IMAGES_IN_RESOURCES
48 #include "../kitlist.xpm"
63 if (ToDIP(frame->get_right_panel_width()).GetWidth() < 1)
163 : wxFrame(
nullptr, wxID_ANY,
"Kitlist", pos),
164 rich_text_printing(),
166 category_list_ctrl(),
169 last_error(
nullptr) {
171 wxLOG_COMPONENT =
"KitList/MyFrame";
174 SetIcon(wxICON(kitlist));
177 file_history_menu =
new wxMenu();
178 file_history =
new wxFileHistory();
179 file_history->UseMenu(file_history_menu);
181 file_menu =
new wxMenu;
182 file_menu->Append(
NEW_FILE, L
"&New\tCtrl-N",
"Create a new kitlist");
183 file_menu->Append(
OPEN_FILE, L
"&Open…\tCtrl-O",
"Open…");
184 file_history_menu_item = file_menu->AppendSubMenu(file_history_menu, L
"Open &Recent…");
185 file_menu->AppendSeparator();
186 file_menu->Append(
SAVE,
"&Save\tCtrl-S",
"Save");
187 file_menu->Append(
SAVE_AS, L
"Save &As…\tShift-Ctrl-S", L
"Save As…");
188 file_menu->AppendSeparator();
189 file_menu->Append(wxID_PRINT,
"&Print...\tCtrl+P",
"Show \"Print\" dialog");
190 file_menu->Append(wxID_PREVIEW,
"Pre&view\tAlt-Shift-Ctrl+V",
"Show print preview");
191 file_menu->AppendSeparator();
192 file_menu->Append(
QUIT,
"&Quit\tCtrl-Q",
"Quit");
194 auto config = wxConfig::Get();
195 auto old_path = config->GetPath();
196 config->SetPath(
"/FileHistory");
197 file_history->Load(*config);
198 config->SetPath(old_path);
200 file_menu->Enable(file_history_menu_item->GetId(), file_history->GetCount() > 0);
201 update_file_menu(
false);
203 edit_menu =
new wxMenu;
204 edit_menu->Append(
ADD_ITEM, L
"New &Item…\tShift-Ctrl-I", L
"Create new item");
205 edit_menu->Append(
ADD_CATEGORY, L
"New &Category…\tShift-Ctrl-N", L
"Create new category");
206 edit_menu->AppendSeparator();
207 edit_menu->Append(
SELECT_ALL_ITEMS,
"Select &All\tCtrl-A",
"Select all items");
208 edit_menu->Append(
UNSELECT_ALL_ITEMS,
"&Unse&lect All\tCtrl-U",
"Unselect all items");
209 edit_menu->AppendSeparator();
210 edit_menu->Append(
CHECK_SELECTED,
"Chec&k Selected\tAlt-Ctrl-K",
"Check selected items");
211 edit_menu->Append(
UNCHECK_SELECTED,
"Uncheck &Selected\tAlt-Ctrl-U",
"Uncheck selected items");
212 edit_menu->Append(
TOGGLE_SELECTED,
"&Toggle Selected\tAlt-Ctrl-T",
"Toggle selected items");
213 edit_menu->AppendSeparator();
215 edit_menu->Append(
REMOVE_SELECTED_ITEMS,
"&Remove Selected Items\tShift-Ctrl-R",
"Remove selected items from the current category");
216 edit_menu->AppendSeparator();
217 edit_menu->Append(
REMOVE_CHECKED_ITEMS,
"&Remove Checked Items\tShift-Ctrl-H",
"Remove checked items from the current category");
218 edit_menu->Append(
DELETE_CHECKED_ITEMS,
"&Delete Checked Items\tShift-Ctrl-H",
"Delete checked items from the current category");
219 edit_menu->AppendSeparator();
220 edit_menu->Append(
CHECK_ALL,
"Ch&eck all\tAlt-Shift-Ctrl-K",
"Check all items in list");
221 edit_menu->Append(
UNCHECK_ALL,
"Unc&heck all\tAlt-Shift-Ctrl-U",
"Uncheck all items in list");
222 edit_menu->Append(
TOGGLE_ALL,
"To&ggle all\tAlt-Shift-Ctrl-T",
"Toggle all items in the list");
223 edit_menu->AppendSeparator();
224 edit_menu->Append(
COPY_CHECKED_TO_CATEGORIES, L
"Copy Checked Ite&ms…\tAlt-Ctrl-c",
"Copy checked items to one or more categories");
233 gui_app->count_filter_items_for_current_selected_category() > 0);
236 wxMenu* view_menu =
new wxMenu;
237 view_menu->Append(
SHOW_ALL_EVENT,
"Show &All\tShift-Ctrl-A",
"Show all", wxITEM_RADIO);
238 view_menu->Append(
SHOW_CHECKED_EVENT,
"Show &Checked\tShift-Ctrl-K",
"Show checked", wxITEM_RADIO);
239 view_menu->Append(
SHOW_UNCHECKED_EVENT,
"Show &Unchecked\tShift-Ctrl-U",
"Show unchecked", wxITEM_RADIO);
241 wxMenu* help_menu =
new wxMenu;
242 help_menu->Append(wxID_ABOUT,
"&About",
"About Kitlist");
244 wxMenuBar* menuBar =
new wxMenuBar;
245 menuBar->Append(file_menu,
"&File");
246 menuBar->Append(edit_menu,
"&Edit");
247 menuBar->Append(view_menu,
"&View");
248 menuBar->Append(help_menu,
"&Help");
254 split_window->SetSize(GetClientSize());
255 split_window->SetSashGravity(0.25);
256 split_window->SetMinimumPaneSize(MIN_PANE_SIZE);
259 auto filename = gui_app->get_filename();
262 if (filename.empty() && file_history->GetCount() > 0) {
263 const wxString last_file = file_history->GetHistoryFile(0);
264 if (!last_file.empty() && wxFileExists(last_file)) {
266 filename = last_file.ToStdString();
267 gui_app->set_filename(filename);
271 if (!filename.empty()) {
273 wxLogInfo(
"Loading \"%s\"", filename);
275 file_history->AddFileToHistory(filename);
276 file_menu->Enable(file_history_menu_item->GetId(),
true);
278 wxLogError(
"%s", e.
what());
279 last_error = std::make_unique<KitListGui::file_not_found>(e);
281 wxLogError(
"%s", e.
what());
282 last_error = std::make_unique<KitParser::parse_exception>(e);
286 auto category_list_sizer =
new wxBoxSizer(wxVERTICAL);
287 left_panel =
new wxPanel(split_window, wxID_ANY);
288 category_list_ctrl =
new wxDataViewListCtrl(left_panel, wxID_ANY);
292 category_list_ctrl->AppendTextColumn(
294 wxDATAVIEW_CELL_EDITABLE,
297 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE);
298 populate_category_list();
299 category_list_sizer->Add(category_list_ctrl, 1, wxGROW);
300 left_panel->SetSizerAndFit(category_list_sizer);
302 auto item_list_sizer =
new wxBoxSizer(wxVERTICAL);
303 right_panel =
new wxPanel(split_window, wxID_ANY);
304 item_list_ctrl =
new wxDataViewListCtrl(right_panel, wxID_ANY,
307 wxDV_ROW_LINES | wxDV_MULTIPLE);
319 wxDataViewColumn* name_view_column = item_list_ctrl->AppendTextColumn(
321 wxDATAVIEW_CELL_EDITABLE,
324 wxDATAVIEW_COL_RESIZABLE |
325 wxDATAVIEW_COL_REORDERABLE |
326 wxDATAVIEW_COL_SORTABLE);
327 wxDataViewColumn* checked_view_column = item_list_ctrl->AppendToggleColumn(
329 wxDATAVIEW_CELL_ACTIVATABLE,
332 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE);
334 checked_view_column->SetMinWidth(40);
335 checked_view_column->SetWidth(60);
336 name_view_column->SetMinWidth(100);
337 name_view_column->SetWidth(270);
338 populate_item_list();
339 item_list_sizer->Add(item_list_ctrl, 1, wxGROW);
340 right_panel->SetSizerAndFit(item_list_sizer);
347 split_window->SplitVertically(left_panel, right_panel, FromDIP(VSPLIT_DIST));
349 old_path = config->GetPath();
350 config->SetPath(
"/MainFrame");
353 int x = config->Read(
"x", 50),
354 y = config->Read(
"y", 50),
355 w = config->Read(
"w", 640),
356 h = config->Read(
"h", 480);
359 config->SetPath(old_path);
360 gui_app->initialization_complete();
361 selected_item_changed();
366 wxConfigBase* config = wxConfig::Get();
367 if (config ==
nullptr)
372 GetClientSize(&w, &h);
374 config->Write(
"/MainFrame/x", (
long) x);
375 config->Write(
"/MainFrame/y", (
long) y);
376 config->Write(
"/MainFrame/w", (
long) w);
377 config->Write(
"/MainFrame/h", (
long) h);
382 const wxDataViewItem anItem =
event.GetItem();
384 if (row != wxNOT_FOUND && row > 0) {
386 const int32_t cat_id = item_data;
391 gui_app->set_category_name(cat_id, s.ToStdString());
397 const wxDataViewItem anItem =
event.GetItem();
399 if (row != wxNOT_FOUND) {
401 const int32_t
id = item_data;
403 shared_ptr<Item> item =
gui_app->get_item(
id);
414 wxVariant name_value, checked_value;
417 const bool b = checked_value;
418 if (b != item->is_checked()) {
419 gui_app->set_item_checked(
id, b);
422 wxString s(name_value);
424 gui_app->set_item_name(
id, s.ToStdString());
426 wxLogError(
"Failed to find item for row %d", row);
429 wxLogError(
"Failed to find row for event");
453 wxDataViewItemArray view_items;
454 const unsigned long long count =
item_list_ctrl->GetSelections(view_items);
457 for (
const auto& view_item : view_items) {
467 const auto cat_id =
gui_app->get_selected_category();
472 wxDataViewItemArray view_items;
476 vector<shared_ptr<Item>> selected_items;
477 for (
const auto& view_item : view_items) {
479 auto item =
gui_app->get_item(
id);
481 selected_items.push_back(item);
484 gui_app->remove_items(selected_items);
492 gui_app->remove_all_current_checked_items();
500 gui_app->delete_all_current_checked_items();
508 const auto items =
gui_app->get_all_items_for_current_selected_category();
509 vector<shared_ptr<Item>> selected_items;
510 for (
const auto& item : items)
511 if (item->is_checked())
512 selected_items.push_back(item);
518 wxDataViewItemArray view_items;
522 vector<shared_ptr<Item>> selected_items;
523 for (
const auto& view_item : view_items) {
525 auto item =
gui_app->get_item(
id);
527 selected_items.push_back(item);
536 auto categories =
gui_app->get_categories();
537 for (
const auto& c : categories)
538 s_cat.Add(wxString::FromUTF8(c->get_name()));
539 wxMultiChoiceDialog dlg(
this,
"Select target categories",
"Categories", s_cat);
540 if (dlg.ShowModal() == wxID_CANCEL)
542 wxArrayInt selected = dlg.GetSelections();
543 vector<shared_ptr<Category>> selected_categories;
544 for (
unsigned int i = 0; i < selected.size(); i++) {
545 const unsigned int idx = selected[i];
546 if (idx >= 0 && idx < categories.size())
547 selected_categories.push_back(categories[idx]);
549 if (!selected_categories.empty())
550 gui_app->copy_items_to_categories(selected_items, selected_categories);
556 const wxDataViewItem anItem =
event.GetItem();
560 if (row == wxNOT_FOUND)
563 const int32_t
id = item_data;
564 shared_ptr<Category> category =
gui_app->get_category(
id);
570 int result = GetPopupMenuSelectionFromUser(menu);
571 if (result == wxID_NONE)
583 const wxDataViewItem anItem =
event.GetItem();
587 if (row == wxNOT_FOUND)
590 const int32_t i = item_data;
592 shared_ptr<Item> item =
gui_app->get_item(i);
593 auto selected_category =
gui_app->get_selected_category();
596 if (selected_category < 0)
602 int result = GetPopupMenuSelectionFromUser(menu);
603 if (result == wxID_NONE)
613 vector<shared_ptr<Item>> items;
614 items.push_back(item);
623 const wxDataViewItem anItem =
event.GetItem();
627 }
else if (row != wxNOT_FOUND && row > 0) {
629 const int32_t cat_id = category_data;
630 const auto found_category =
gui_app->get_category(cat_id);
632 gui_app->select_category(cat_id);
634 wxLogError(
"Failed to find category with ID %d", cat_id);
655 auto categories =
gui_app->get_categories();
656 wxVector<wxVariant> data;
657 data.push_back(wxVariant(
gui_app->all_items_text));
661 for (
const shared_ptr<Category>& cat : categories) {
662 data.push_back(wxVariant(wxString::FromUTF8(cat->get_name())));
663 wxUIntPtr client_data = cat->get_id();
665 if (select_category == cat->get_id())
676 const auto items =
gui_app->filter_items_for_current_selected_category();
677 wxVector<wxVariant> data;
678 for (
const shared_ptr<Item>& item : items) {
679 wxUIntPtr client_data = item->get_id();
680 data.push_back(wxVariant(wxString::FromUTF8(item->get_name())));
681 data.push_back(wxVariant(item->is_checked()));
689 auto config = wxConfig::Get();
690 const auto old_path = config->GetPath();
691 config->SetPath(
"/reports/item-list");
692 const auto title = config->Read(
"title",
"Kitlist");
693 config->SetPath(old_path);
695 rich_text_printing->SetHeaderText(
"@TITLE@", wxRICHTEXT_PAGE_ALL, wxRICHTEXT_PAGE_CENTRE);
696 rich_text_printing->SetFooterText(
"- @PAGENUM@ / @PAGESCNT@ -", wxRICHTEXT_PAGE_ALL, wxRICHTEXT_PAGE_CENTRE);
704 wxRichTextBuffer buf;
713 wxRichTextBuffer buf;
720 const auto items =
gui_app->filter_items_for_current_selected_category();
721 buf.BeginParagraphSpacing(10, 10);
722 for (
const shared_ptr<Item>& item : items)
723 buf.AddParagraph(wxString::FromUTF8(item->get_name()));
730 const auto row =
my_frame->populate_category_list(category->get_id());
731 my_frame->category_list_ctrl->SelectRow(row);
760 wxApp::OnInitCmdLine(parser);
764 parser.AddSwitch(
"v",
"version",
"shows the application's version and exits");
765 parser.AddParam(
"FILENAME", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL);
767 parser.AddSwitch(
"t",
"finalcut",
"runs the application with FINAL CUT Text-based User Interface");
770 parser.AddSwitch(
"x",
"ftxui",
"runs the application with FTXUI Text-based User Interface");
777 if (parser.GetParamCount() > 0) {
784 if (parser.Found(
"verbose")) {
785 wxLog::SetLogLevel(wxLOG_Debug);
787 wxLog::SetLogLevel(wxLOG_Message);
790 if (parser.Found(
"version")) {
791 std::cout << PACKAGE_NAME <<
" version " << PACKAGE_VERSION << std::endl;
795 if (parser.Found(
"finalcut")) {
802 if (parser.Found(
"ftxui")) {
806 wxLogError(
"Specify an existing kitlist file when using the FTXUI interface.");
813 return wxApp::OnCmdLineParsed(parser);
818 if (!wxApp::OnInit())
821 wxLOG_COMPONENT =
"KitList";
824 wxLog* logger =
new wxLogStream(&cout);
825 wxLog::SetActiveTarget(logger);
828 wxLog* logger =
new wxLogStream(&cout);
829 wxLog::SetActiveTarget(logger);
831 cerr <<
"Disabling logging as compiled with GCC on Apple aarch64\n";
832 wxLog::EnableLogging(
false);
837 wxLogWarning(
"Assertions are enabled. Configure with --disable-assertions to disable them.");
839 SetVendorName(
"uk.co.fdsd.kitlist");
840 SetAppName(
"kitlist-2");
841 auto config =
new wxConfig(GetAppName(), GetVendorName(), wxString{}, wxString{}, wxCONFIG_USE_LOCAL_FILE);
843 config->SetRecordDefaults();
844 wxConfig::Set(config);
853 return wxApp::OnExit();
860 wxMessageBox(
last_error->what(),
"Error", wxICON_ERROR);
870 wxAboutDialogInfo aboutInfo;
871 aboutInfo.SetName(
"Kitlist");
872 aboutInfo.SetVersion(PACKAGE_VERSION);
873 aboutInfo.SetDescription(
"A list manager for maintaining kit lists");
874 aboutInfo.SetCopyright(
"(C) 2008-2025");
875 aboutInfo.SetWebSite(
"https://www.fdsd.co.uk/kitlist");
876 aboutInfo.AddDeveloper(
"Frank Dean <frank.dean@fdsd.co.uk>");
877 wxAboutBox(aboutInfo);
884 if (wxMessageBox(
"Kitlist has not been saved! Continue?",
"Please confirm",
885 wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT | wxCANCEL,
this) != wxYES)
897 if (wxMessageBox(
"Kitlist has not been saved! Continue?",
"Please confirm",
898 wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT | wxCANCEL,
this) != wxYES)
908 if (wxMessageBox(
"Kitlist has not been saved! Continue?",
"Please confirm",
909 wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT | wxCANCEL,
this) != wxYES)
912 wxFileDialog openFileDialog(
913 this,
"Open Kitlist file",
"",
"",
914 "Kitlist files (*.kit)|*.kit|XML files (*.xml)|*.xml|All files|*",
915 wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR);
917 if (openFileDialog.ShowModal() == wxID_CANCEL)
920 do_open(openFileDialog.GetPath());
926 const string path = wx_path.ToStdString();
933 wxLogError(
"File not found: %s", wx_path);
934 wxMessageDialog dlg(
this, wxString(e.
what()),
"File not found", wxICON_ERROR);
937 wxLogError(
"Failure loading \"%s\": %s", wx_path, wxString::FromUTF8(e.
what()));
938 wxMessageDialog dlg(
this, wxString(e.
what()), wxMessageBoxCaptionStr, wxICON_ERROR);
959 wxFileDialog saveFileDialog(
960 this,
"Save Kitlist file",
"",
"",
961 "Kitlist files (*.kit)|*.kit",
962 wxFD_SAVE | wxFD_CHANGE_DIR | wxFD_OVERWRITE_PROMPT);
964 if (saveFileDialog.ShowModal() == wxID_CANCEL)
967 wxString wx_path = saveFileDialog.GetPath();
972 gui_app->set_filename(wx_path.ToStdString());
981 if (wxMessageBox(
"Kitlist has not been saved! Quit anyway?",
"Please confirm",
982 wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT| wxCANCEL,
this) != wxYES)
985 auto config = wxConfig::Get();
986 const auto old_path = config->GetPath();
987 config->SetPath(
"/FileHistory");
989 config->SetPath(old_path);
996 if (dlg.ShowModal() == wxID_CANCEL)
1004 gui_app->new_item(name, checked);
1010 auto d = wxTextEntryDialog(
this,
"Category name",
"New Category");
1011 if (d.ShowModal() == wxID_CANCEL)
1013 const string name = d.GetValue().ToStdString();
1016 auto cat_id =
gui_app->new_category(name);
1017 gui_app->select_category(cat_id);
1025 bool result =
gui_app->save();
1027 SetStatusText(
"Saved");
1029 SetStatusText(
"Save failed");
1046 const bool have_visible_items = visible_item_count != 0;
1047 const bool have_checked_items =
gui_app->get_current_checked_item_count();
1060 have_selected_items &&
1061 is_category_selected);
1063 have_visible_items &&
1064 is_category_selected);
1066 have_visible_items &&
1067 !is_category_selected);
1076 : wxDialog(parent, wxID_ANY, title,
1077 wxDefaultPosition, wxDefaultSize,
1078 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
1082 wxBoxSizer* main_sizer =
new wxBoxSizer(wxVERTICAL);
1083 wxBoxSizer* item_options_sizer =
new wxBoxSizer(wxHORIZONTAL);
1085 wxDefaultPosition, wxDefaultSize,
1086 wxCHK_2STATE | wxALIGN_RIGHT);
1088 wxSizerFlags().Border().Center());
1089 item_options_sizer->Add(
new wxStaticText(
this, wxID_ANY,
"Item name"),
1090 wxSizerFlags().Border().Center());
1091 name_ctrl =
new wxTextCtrl(
this, wxID_ANY);
1092 auto min_size =
name_ctrl->GetMinSize();
1093 min_size.SetWidth(180);
1095 item_options_sizer->Add(
name_ctrl, wxSizerFlags().Proportion(1).Center());
1096 main_sizer->Add(item_options_sizer, wxSizerFlags().DoubleBorder().Expand().Proportion(1));
1097 wxSizer* button_sizer = CreateSeparatedButtonSizer( wxOK|wxCANCEL );
1098 main_sizer->Add(button_sizer, wxSizerFlags().Border().Expand());
1099 SetSizerAndFit( main_sizer );
A dialog for editing or creating an Item.
ItemDialog(wxWindow *parent, const wxString &title)
wxTextCtrl * name_ctrl
The input control for the item name.
const std::string get_name() const
The name.
bool is_checked() const
Whether checkbox was checked.
wxCheckBox * checkbox_ctrl
The checkbox control.
Exception throw when a file is not found.
virtual const char * what() const override
Describes the exeption.
const std::string get_filename() const
std::string filename
The current filename the Model was loaded from.
virtual void load_file(const std::string &filename)
Loads the specified file.
void set_filename(const std::string &filename)
Sets a new filename to associate with the Model.
static const std::string DEFAULT_FILE_EXTENSION
The application's default filename extension. .kit.
Implements a GUI front-end for the application using wxWidgets.
MyFrame * my_frame
The main frame of the application.
virtual bool OnCmdLineParsed(wxCmdLineParser &parser) override
Called after the command line has been successfully parsed.
virtual void OnInitCmdLine(wxCmdLineParser &parser) override
Called from OnInit() and initializes the parser with the command line options for the application.
virtual int OnExit() override
Can be used to cleanup items created during OnInit().
virtual void update_menu_state(bool is_dirty) override
Enables or disables various menu options, as appropriate.
virtual void category_entry_changed(const std::shared_ptr< Category > category) override
Called whenever a Category name changes.
virtual bool OnInit() override
Initializes the application's main window.
virtual void load_file(const std::string &filename) override
Loads the specified file.
virtual void item_entry_changed(const std::shared_ptr< Item > item) override
Called whenever a Item name changes.
check_action
Specifies what state Item checkmarks must be changed to.
static const int32_t no_category
Indicates no filtering by category.
Implements the main frame of the GUI.
void OnShowAll(wxCommandEvent &WXUNUSED(event))
Menu event handler for showing all items.
void OnUncheckSelected(wxCommandEvent &event)
Menu handler called to mark all selected items as unchecked.
void delete_category(int32_t id)
Deletes the specified Category from the model.
void OnRemoveCheckedItems(wxCommandEvent &WXUNUSED(event))
Menu handler called to remove checked items from a Category.
unsigned populate_category_list(int32_t select_category=Model::no_category)
Rebuilds the list of categories.
void OnUncheckAll(wxCommandEvent &WXUNUSED(event))
Menu handler called to uncheck all items in the list.
wxMenu * file_menu
The File menu.
void OnSave(wxCommandEvent &event)
Menu event handler to save the current file.
void OnNewFile(wxCommandEvent &event)
Menu event handler for creating a new blank model.
static const int ITEM_NAME_COL
The zero based indexed position of the item name column.
void OnCategoryContextMenu(wxDataViewEvent &event)
Implements a pop-up context menu for the Category list.
void OnCheckSelected(wxCommandEvent &event)
Menu handler called to mark all selected items as checked.
void OnUnselectAllItems(wxCommandEvent &WXUNUSED(event))
Menu event handler for unselecting all items.
void OnPrintPreview(wxCommandEvent &event)
Provides a print previews of the list of items.
void CopyCheckedToCategories(wxCommandEvent &WXUNUSED(event))
Menu handler called to copy checked items to one or more categories.
void do_open(wxString wx_path)
Opens the file from the specified path.
void OnToggleAll(wxCommandEvent &WXUNUSED(event))
Menu handler called to toggle the checked state of all items in the list.
wxDataViewListCtrl * category_list_ctrl
The Category list control.
void change_selected_checked_states(Model::check_action action)
Switches the checked state of all the currently selected items in the item list.
void OnItemContextMenu(wxDataViewEvent &event)
Implements a pop-up context menu for the Item list.
std::unique_ptr< std::exception > last_error
Holds the most recent exception that occurred or nullptr if no exception.
static const int MIN_PANE_SIZE
The minimum size that the split window can be changed to by the user.
void delete_item(int32_t id)
Deletes the specified Item from the model.
void OnAddCategory(wxCommandEvent &WXUNUSED(event))
Menu event handler for creating a new Category.
void update_file_menu(bool is_dirty)
KitListGui * gui_app
Pointer to the main GUI class.
void OnShowUnchecked(wxCommandEvent &WXUNUSED(event))
Menu event handler for showing only unchecked items.
void OnCategoryStartEditing(wxDataViewEvent &event)
Event handler implemented to disallow editing the first row of the Category list.
void load_file(const std::string filename)
Loads the specified file.
virtual ~MyFrame()
Destructor.
void OnOpen(wxCommandEvent &event)
Menu event handler to open another file.
void setup_rich_text_printing()
Sets up rich text printing.
static const int CATEGORY_NAME_COL
The zero based indexed of the category name column.
void remove_item(int32_t id)
Removes references to the item from the currently selected Category.
void selected_item_changed()
Disables or enables menu items, depending on whether any items have been selected in the Item list.
void OnFileHistoryMenuItem(wxCommandEvent &event)
Menu event handler to open a file that has been selected from the recent files menu.
std::unique_ptr< wxRichTextPrinting > rich_text_printing
Pointer to an instance supporting rich text printing.
wxFileHistory * file_history
The list of recent files.
wxMenu * edit_menu
The Edit menu.
void OnAddItem(wxCommandEvent &WXUNUSED(event))
Menu event handler for creating a new Item.
wxMenuItem * file_history_menu_item
A pointer to the recent files menu item.
void OnPrint(wxCommandEvent &event)
Prints the list of items.
void OnQuit(wxCommandEvent &event)
Called when the user chooses to quit the application.
void OnCheckAll(wxCommandEvent &WXUNUSED(event))
Menu handler called to check all items in the list.
wxDataViewListCtrl * item_list_ctrl
Pointer to the Item list controller.
void OnShow(wxShowEvent &event)
Event handler for when the window is shown.
void OnCopySelectedItemsToCategories(wxCommandEvent &event)
Menu handler called to copy selected items to one or more categories.
void OnShowChecked(wxCommandEvent &WXUNUSED(event))
Menu event handler for showing only checked items.
void FillBuffer(wxRichTextBuffer &buf) const
Fills the passed buffer with rich text to print or preview.
void OnSelectItem(wxDataViewEvent &event)
Event handler called when a user selects a Item from the list. Calls selected_item_changed().
void OnAbout(wxCommandEvent &event)
Menu event handler showing an About dialog box.
void OnSelectAllItems(wxCommandEvent &WXUNUSED(event))
Menu event handler for selecting all items.
void OnRemoveSelectedItems(wxCommandEvent &event)
Menu handler called to remove selected items from a Category.
void populate_item_list()
Rebuilds the list of items.
static const int VSPLIT_DIST
The initial width of the category column.
void update_edit_menu()
Enables or disables menu items on the Edit menu.
void OnToggleSelected(wxCommandEvent &event)
Menu handler called to toggle the checked state of all selected items.
void select_and_copy_to_categories(std::vector< std::shared_ptr< Item > > selected_items)
Displays a dialog for user to select target categories to copy selected items to.
void OnItemListValueChanged(wxDataViewEvent &event)
Event handler called when the Item name is edited.
void save()
Saves the current Model using the current KitListBaseApp::filename.
static const int ITEM_CHECKED_COL
The zero based indexed position of the item checked column.
void OnDeleteCheckedItems(wxCommandEvent &WXUNUSED(event))
Menu handler called to delete checked items from the model.
void OnSelectCategory(wxDataViewEvent &event)
Event handler called when a user selects a Category from the list.
void OnCategoryListValueChanged(wxDataViewEvent &event)
Event handler called when the Category name is edited.
void OnSaveAs(wxCommandEvent &event)
Menu event handler to save the model to a new file.
Implements the application's split window.
void OnPositionChanged(wxSplitterEvent &event)
Implements a workaround on Linux to initialize the split window correctly on startup.
Main Text-based User Interface (FINALCUT) for the application.
int run(int argc, char *argv[], const std::string filename)
Runs the FINAL CUT text based user interface.
Implements an FTXUI text based user interface.
int run(const std::string filename)
The main run loop.
wxBEGIN_EVENT_TABLE(MySplitterWindow, wxSplitterWindow) wxEND_EVENT_TABLE() void MySplitterWindow
@ COPY_SELECTED_ITEMS_TO_CATEGORIES
@ COPY_CHECKED_TO_CATEGORIES
@ COPY_ITEM_TO_CATEGORIES
@ CATEGORY_ITEM_START_EDITING