Skip to content

Commit

Permalink
Follow up 3f0d094
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 29, 2014
1 parent 3f0d094 commit 950c9b8
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
40 changes: 40 additions & 0 deletions python/core/composer/qgscomposermultiframecommand.sip
Expand Up @@ -12,7 +12,47 @@ class QgsComposerMultiFrameCommand : QUndoCommand

void savePreviousState();
void saveAfterState();

QDomDocument previousState() const;
QDomDocument afterState() const;

/**Returns true if previous state and after state are valid and different*/
bool containsChange() const;

const QgsComposerMultiFrame* multiFrame() const;

protected:

QgsComposerMultiFrameCommand(); //forbidden
void saveState( QDomDocument& stateDoc );
void restoreState( QDomDocument& stateDoc );
bool checkFirstRun();
};


/**A composer command that merges together with other commands having the same context (=id)
* for multi frame items. Keeps the oldest previous state and uses the newest after state.
* The purpose is to avoid too many micro changes in the history*/
class QgsComposerMultiFrameMergeCommand: QgsComposerMultiFrameCommand
{
%TypeHeaderCode
#include <qgscomposermultiframecommand.h>
%End
public:
enum Context
{
Unknown = 0,
//composer html
HtmlSource,
HtmlStylesheet,
HtmlBreakDistance
};

QgsComposerMultiFrameMergeCommand( Context c, QgsComposerMultiFrame* multiFrame, const QString& text );
~QgsComposerMultiFrameMergeCommand();

bool mergeWith( const QUndoCommand * command );
int id() const;

};

2 changes: 1 addition & 1 deletion python/core/composer/qgscomposition.sip
Expand Up @@ -368,7 +368,7 @@ class QgsComposition : QGraphicsScene
/**Deletes current command*/
void cancelCommand();

void beginMultiFrameCommand( QgsComposerMultiFrame* multiFrame, const QString& text );
void beginMultiFrameCommand( QgsComposerMultiFrame* multiFrame, const QString& text, const QgsComposerMultiFrameMergeCommand::Context c = QgsComposerMultiFrameMergeCommand::Unknown );
void endMultiFrameCommand();

/**Adds multiframe. The object is owned by QgsComposition until removeMultiFrame is called*/
Expand Down

0 comments on commit 950c9b8

Please sign in to comment.