Changeset 53 in projects for punch-card/punch-card-editor/src/text/editor.h
- Timestamp:
- Dec 24, 2009, 4:17:54 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
punch-card/punch-card-editor/src/text/editor.h
r52 r53 8 8 namespace Text { 9 9 class Editor; 10 class CharUndoCommand; 11 class StringUndoCommand; 10 12 }; 11 13 }; … … 14 16 #include "deckviewer/cardeditor.h" 15 17 #include "qpunchcard/card.h" 18 #include "qpunchcard/deck.h" 16 19 #include "text/editordock.h" 17 20 #include "text/codec.h" … … 78 81 void translateChanges(int position, int charsRemoved, int charsAdded); 79 82 80 }; // class 83 }; // class Editor 84 85 /* 86 class CharUndoCommand : public DeckUndoCommand { 87 CharUndoCommand(Deck* editor, DeckIndex& position, CardIndex column, Card old_content, 88 const Codec* codec, char new_char, QUndoCommand *parent = 0) : 89 DeckUndoCommand(deck, parent), column(column), old_content(old_content), 90 codec(codec), new_char(new_char) { 91 } 92 93 old_content = *position.getCard(); 94 setText(position.getDeck()->tr("Changed contents of card").arg(position)); 95 } 96 void undo() { position.getDeck()->cards[position] = old_content; } 97 void redo() { position.getDeck()->cards[position] = new_content; } 98 private: 99 DeckIndex position; 100 Card old_content; 101 CardIndex column; 102 const Codec* codec; 103 char new_char; 104 }; // class CharUndoCommand 105 */ 106 107 /* 108 class ModifyLine : public DeckModifyCard { 109 public: 110 ModifyLine(Deck* deck, const QString& new_text, const Codec* codec, 111 DeckIndex& position, QUndoCommand* parent=0) : DeckModifyCard(deck, position, Card, parent) { 112 codec->fromAscii(codec, &new_content); 113 position.assertDeck(deck); 114 Q_ASSERT(this->deck); 115 116 // alten Inhalt irgendwie sichern 117 old_content = *position.getCard(); 118 setText(position.getDeck()->tr("Changed contents of card").arg(position)); 119 } 120 void undo() { position.getDeck()->cards[position] = old_content; } 121 void redo() { position.getDeck()->cards[position] = new_content; } 122 private: 123 124 DeckIndex position; 125 Card new_content; 126 Card old_content; 127 }; 128 */ 129 81 130 82 131 }; // namespace Text
Note: See TracChangeset
for help on using the changeset viewer.