#ifndef UNDO_H #define UNDO_H #include #ifndef WX_PRECOMP #include #endif #include #include #include class MapeditFrame; class Undoable { public: Undoable(std::string title, std::function forward, std::function backward); virtual std::string getTitle() const; virtual void apply(); virtual void undo(); virtual void endChanges() {} protected: Undoable() {} std::string title; std::function forward; std::function backward; }; class UndoableTextBox : public wxTextCtrl { public: UndoableTextBox(); UndoableTextBox(wxWindow* parent, wxWindowID id, wxString startText, std::string undoType, MapeditFrame* realParent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0); private: class Undo : public Undoable { public: Undo(std::string title, wxString origText, UndoableTextBox& parent); void apply(); void undo(); void endChanges(); wxString origText; wxString newText; UndoableTextBox& parent; }; void Init(); void OnFocus(wxFocusEvent& event); void OnKillFocus(wxFocusEvent& event); void OnTextChange(wxCommandEvent& event); MapeditFrame* realParent; std::string undoText; wxString curText; std::shared_ptr undo; wxDECLARE_EVENT_TABLE(); }; class UndoableChoice : public wxChoice { public: UndoableChoice(); UndoableChoice(wxWindow* parent, wxWindowID id, MapeditFrame* realParent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxChoiceNameStr); protected: void Init(); void OnChoose(wxCommandEvent& event); private: MapeditFrame* realParent; }; class UndoableSlider : public wxSlider { public: UndoableSlider(); UndoableSlider(wxWindow* parent, wxWindowID id, MapeditFrame* realParent, int value, int minvalue, int maxvalue, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxSL_HORIZONTAL, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxSliderNameStr); protected: void Init(); void OnSlide(wxScrollEvent& event); private: MapeditFrame* realParent; wxDECLARE_EVENT_TABLE(); }; #endif on>
blob: 43bca70a70d8206a14873d7f4cdcc38d07c3aebc (plain) (blame)
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
connections {
  from_room: "First Room"
  to_room: "First Room Exit"
  door { name: "Second Room Entrance" }
}
connections {
  from {
    port {
      room: "First Room Exit"
      name: "NEXT"
    }
  }
  to {
    port {
      room: "Second Room"
      name: "ENTRY"
    }
  }
  oneway: true
}
connections {
  from_room: "Second Room"
  to_room: "Second Room Exit"
  door { name: "Third Room Entrance" }
}
connections {
  from {
    port {
      room: "Second Room Exit"
      name: "NEXT"
    }
  }
  to {
    port {
      room: "Third Room"
      name: "ENTRY"
    }
  }
  oneway: true
}
connections {
  from_room: "Third Room"
  to_room: "S Room"
  door { name: "S1 Door" }
}
connections {
  from_room: "First Room"
  to_room: "Cyan Hallway"
  door { name: "Colorful Entrance" }
}
connections {
  from_room: "Second Room"
  to_room: "Congruent Entrance"
  door { name: "Congruent Entrance" }
}
connections {
  from_room: "First Room"
  to_room: "Double Sided Entrance"
  door { name: "Double Sided Entrance" }
}