Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/view/helper/ControlCommand.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 101 - (show annotations) (download) (as text)
Fri Feb 1 01:09:56 2013 UTC (11 years, 2 months ago) by haruneko24
File MIME type: text/x-c++src
File size: 1029 byte(s)


1 #include "ControlCommand.h"
2
3 #include "ControlItem.h"
4
5 using namespace stand::view::helper;
6
7 ControlCommand::ControlCommand(QUndoCommand *parent)
8 : QUndoCommand(parent)
9 {
10 w = NULL;
11 control = NULL;
12 }
13
14 void ControlCommand::undo()
15 {
16 QUndoCommand::undo();
17 if(oldP.empty() || !control)
18 {
19 return;
20 }
21 if(newP.empty())
22 {
23 control->replace(oldP, oldP.first().tick, oldP.last().tick);
24 }
25 else
26 {
27 control->replace(oldP, newP.first().tick, newP.last().tick);
28 }
29 if(w)
30 {
31 w->update();
32 }
33 QUndoCommand::undo();
34 }
35
36 void ControlCommand::redo()
37 {
38 QUndoCommand::redo();
39 if(newP.empty() || !control)
40 {
41 return;
42 }
43 if(oldP.empty())
44 {
45 control->replace(newP, newP.first().tick, newP.last().tick);
46 }
47 else
48 {
49 control->replace(newP, oldP.first().tick, oldP.last().tick);
50 }
51 if(w)
52 {
53 w->update();
54 }
55 QUndoCommand::redo();
56 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26