Develop and Download Open Source Software

Browse Subversion Repository

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 101 - (hide 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 haruneko24 68 #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 haruneko24 78 w = NULL;
11 haruneko24 101 control = NULL;
12 haruneko24 68 }
13    
14     void ControlCommand::undo()
15     {
16 haruneko24 69 QUndoCommand::undo();
17 haruneko24 101 if(oldP.empty() || !control)
18 haruneko24 68 {
19     return;
20     }
21 haruneko24 78 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 haruneko24 82 QUndoCommand::undo();
34 haruneko24 68 }
35    
36     void ControlCommand::redo()
37     {
38 haruneko24 69 QUndoCommand::redo();
39 haruneko24 101 if(newP.empty() || !control)
40 haruneko24 68 {
41     return;
42     }
43 haruneko24 78 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 haruneko24 82 QUndoCommand::redo();
56 haruneko24 68 }

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