Skip to content

Commit

Permalink
UndoManager: Add line breaks to XML output
Browse files Browse the repository at this point in the history
Task: GH-1290 (revision control friendly file format)
  • Loading branch information
dg0yt committed Oct 5, 2019
1 parent e610a04 commit f9660c5
Show file tree
Hide file tree
Showing 25 changed files with 109 additions and 50 deletions.
6 changes: 4 additions & 2 deletions examples/complete map.omap
Original file line number Diff line number Diff line change
Expand Up @@ -4904,7 +4904,9 @@ do not assume any liability!</text></object>
<print scale="4000" resolution="300" simulate_overprinting="true" mode="raster"><page_format paper_size="A4" orientation="portrait" h_overlap="5" v_overlap="5"><dimensions width="210" height="297"/><page_rect left="4.23" top="3.53" width="201.54" height="289.94"/></page_format><print_area left="-103.672" top="-146.153" width="201.54" height="289.94" center_area="true" single_page="true"/></print>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions examples/forest sample.omap
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,9 @@ The purple line will extend a bit into the finish symbol. This is a shortcoming
<print scale="10000" resolution="600" simulate_overprinting="true" mode="raster"><page_format paper_size="Custom" orientation="portrait" h_overlap="5" v_overlap="5"><dimensions width="110" height="110"/><page_rect left="0" top="0" width="110" height="110"/></page_format><print_area left="59.639" top="18.763" width="74.685" height="65.687" center_area="true"/></print>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions examples/overprinting.omap
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ overprinting preview.</text></object>
<print scale="15000" resolution="600" simulate_overprinting="true" mode="raster"><page_format paper_size="Custom" orientation="portrait" h_overlap="5" v_overlap="5"><dimensions width="110" height="110"/><page_rect left="0" top="0" width="110" height="110"/></page_format><print_area left="-80.283" top="-98.762" width="110" height="110" center_area="true"/></print>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
12 changes: 10 additions & 2 deletions src/undo/undo_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,11 @@ void UndoManager::saveUndo(QXmlStreamWriter& xml) const
}

XmlElementWriter undo_element(xml, QLatin1String("undo"));
std::for_each(first_valid, last, [&xml](auto& step) { step->save(xml); });
writeLineBreak(xml);
std::for_each(first_valid, last, [&xml](auto& step) {
step->save(xml);
writeLineBreak(xml);
});
}

void UndoManager::saveRedo(QXmlStreamWriter& xml) const
Expand All @@ -421,7 +425,11 @@ void UndoManager::saveRedo(QXmlStreamWriter& xml) const
}

XmlElementWriter redo_element(xml, QLatin1String("redo"));
std::for_each(first_valid, last, [&xml](auto& step) { step->save(xml); });
writeLineBreak(xml);
std::for_each(first_valid, last, [&xml](auto& step) {
step->save(xml);
writeLineBreak(xml);
});
}


Expand Down
6 changes: 4 additions & 2 deletions symbol sets/10000/Course_Design_10000.omap
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,9 @@ The orientation of the symbol indicates the direction in which the corner points
<print scale="10000" resolution="600" templates_visible="true" mode="vector"><page_format paper_size="A4" orientation="portrait" h_overlap="5" v_overlap="5"><dimensions width="210" height="297"/><page_rect left="5" top="5" width="200" height="287"/></page_format><print_area left="5" top="5" width="200" height="287" center_area="true" single_page="true"/></print>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions symbol sets/10000/ISMTBOM_10000.omap
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,9 @@ Note: if the stream is wider than 0.25mm, adjust this symbol so it extends 0.5mm
</view>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions symbol sets/10000/ISOM2000_10000.omap
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ The purple line will extend a bit into the finish symbol. This is a shortcoming
</view>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions symbol sets/10000/ISOM2017_10000.omap
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,9 @@ The purple line will extend a bit into the finish symbol. This is a shortcoming
</view>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions symbol sets/10000/ISSkiOM_10000.omap
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ Note: if the stream is wider than 0.25mm, adjust this symbol so it extends 0.5mm
</view>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions symbol sets/15000/Course_Design_15000.omap
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,9 @@ The orientation of the symbol indicates the direction in which the corner points
<print scale="15000" resolution="600" templates_visible="true" mode="vector"><page_format paper_size="A4" orientation="portrait" h_overlap="5" v_overlap="5"><dimensions width="210" height="297"/><page_rect left="5" top="5" width="200" height="287"/></page_format><print_area left="5" top="5" width="200" height="287" center_area="true" single_page="true"/></print>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions symbol sets/15000/ISMTBOM_15000.omap
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,9 @@ Note: if the stream is wider than 0.25mm, adjust this symbol so it extends 0.5mm
</view>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions symbol sets/15000/ISOM2000_15000.omap
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ The purple line will extend a bit into the finish symbol. This is a shortcoming
</view>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions symbol sets/15000/ISOM2017_15000.omap
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,9 @@ The purple line will extend a bit into the finish symbol. This is a shortcoming
</view>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions symbol sets/15000/ISSkiOM_15000.omap
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ Note: if the stream is wider than 0.25mm, adjust this symbol so it extends 0.5mm
</view>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions symbol sets/20000/ISMTBOM_20000.omap
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,9 @@ Note: if the stream is wider than 0.25mm, adjust this symbol so it extends 0.5mm
</view>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions symbol sets/4000/Course_Design_4000.omap
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,9 @@ The orientation of the symbol indicates the direction in which the corner points
<print scale="4000" resolution="600" templates_visible="true" mode="vector"><page_format paper_size="A4" orientation="portrait" h_overlap="5" v_overlap="5"><dimensions width="210" height="297"/><page_rect left="5" top="5" width="200" height="287"/></page_format><print_area left="5" top="5" width="200" height="287" center_area="true" single_page="true"/></print>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions symbol sets/4000/ISSOM_4000.omap
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,9 @@ The purple line will extend a bit into the finish symbol. This is a shortcoming
</view>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions symbol sets/5000/Course_Design_5000.omap
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,9 @@ The orientation of the symbol indicates the direction in which the corner points
<print scale="5000" resolution="600" templates_visible="true" mode="vector"><page_format paper_size="A4" orientation="portrait" h_overlap="5" v_overlap="5"><dimensions width="210" height="297"/><page_rect left="5" top="5" width="200" height="287"/></page_format><print_area left="5" top="5" width="200" height="287" center_area="true" single_page="true"/></print>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions symbol sets/5000/ISMTBOM_5000.omap
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,9 @@ Note: if the stream is wider than 0.25mm, adjust this symbol so it extends 0.5mm
</view>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions symbol sets/5000/ISSOM_5000.omap
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,9 @@ The purple line will extend a bit into the finish symbol. This is a shortcoming
</view>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions symbol sets/5000/ISSkiOM_5000.omap
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ Note: if the stream is wider than 0.25mm, adjust this symbol so it extends 0.5mm
</view>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions symbol sets/7500/ISMTBOM_7500.omap
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,9 @@ Note: if the stream is wider than 0.25mm, adjust this symbol so it extends 0.5mm
</view>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
7 changes: 5 additions & 2 deletions test/data/tags.omap
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
</view>
</barrier>
<barrier version="6" required="0.6.0">
<undo><step type="7"><affected_objects part="0"><ref object="0"><t k="author">dg0yt</t></ref></affected_objects></step></undo>
<redo/>
<undo>
<step type="7"><affected_objects part="0"><ref object="0"><t k="author">dg0yt</t></ref></affected_objects></step>
</undo>
<redo>
</redo>
</barrier>
</map>
6 changes: 4 additions & 2 deletions test/data/text-object.omap
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ anchor</text></object>
</view>
</barrier>
<barrier version="6" required="0.6.0">
<undo/>
<redo/>
<undo>
</undo>
<redo>
</redo>
</barrier>
</map>
8 changes: 6 additions & 2 deletions test/data/undo.omap
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
</view>
</barrier>
<barrier version="6" required="0.6.0">
<undo><step type="7"><affected_objects part="0"><ref object="0"><t k="author">dg0yt</t></ref></affected_objects></step><step type="0"><affected_objects part="0"><ref object="0"/></affected_objects><contained_objects count="1"><object type="4" symbol="0" rotation="0" h_align="1" v_align="2"><tags><t k="created">2019-09-30</t><t k="author">dg0yt</t></tags><coords count="2">10000 0;16000 10000;</coords><text>object</text></object></contained_objects></step></undo>
<redo/>
<undo>
<step type="7"><affected_objects part="0"><ref object="0"><t k="author">dg0yt</t></ref></affected_objects></step>
<step type="0"><affected_objects part="0"><ref object="0"/></affected_objects><contained_objects count="1"><object type="4" symbol="0" rotation="0" h_align="1" v_align="2"><tags><t k="created">2019-09-30</t><t k="author">dg0yt</t></tags><coords count="2">10000 0;16000 10000;</coords><text>object</text></object></contained_objects></step>
</undo>
<redo>
</redo>
</barrier>
</map>

0 comments on commit f9660c5

Please sign in to comment.