Created class ObjectCollection to manage the list of objects in the program. Converted the program to use it. Not fully functional yet.

This commit is contained in:
Juan Pablo Caram
2014-04-02 19:53:00 -04:00
parent 69fbe7a9a3
commit 609561f7a3
5 changed files with 746 additions and 645 deletions

View File

@@ -132,6 +132,404 @@ THE SOFTWARE.</property>
<property name="can_focus">False</property>
<property name="stock">gtk-open</property>
</object>
<object class="GtkOffscreenWindow" id="offscreenwindow_dblsided">
<property name="can_focus">False</property>
<child>
<object class="GtkScrolledWindow" id="sw_dblsided">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport" id="vp_dblsided">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="box_dblsided">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label53">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">6</property>
<property name="ypad">3</property>
<property name="label" translatable="yes">Double-Sided PCB Tool</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">3</property>
<property name="column_spacing">3</property>
<child>
<object class="GtkLabel" id="label84">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_markup" translatable="yes">The object that you want to flip around,
usually the Gerber object defining the
bottom copper layer. You can also flip
an Excellon object in case you want to drill
from the bottom side.</property>
<property name="xalign">1</property>
<property name="xpad">3</property>
<property name="label" translatable="yes">Bottom Layer:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="comboboxtext_bottomlayer">
<property name="width_request">200</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label85">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_markup" translatable="yes">&lt;b&gt;X&lt;/b&gt; flips from top to bottom,
&lt;b&gt;Y&lt;/b&gt; flips from left to right.</property>
<property name="xalign">1</property>
<property name="xpad">3</property>
<property name="label" translatable="yes">Mirror Axis:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box24">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">10</property>
<child>
<object class="GtkRadioButton" id="rb_mirror_x">
<property name="label" translatable="yes">X</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="rb_mirror_y">
<property name="label" translatable="yes">Y</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<property name="group">rb_mirror_x</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label86">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_markup" translatable="yes">How the location of the axis
is specified.</property>
<property name="xalign">1</property>
<property name="xpad">3</property>
<property name="label" translatable="yes">Axis location:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box25">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">10</property>
<child>
<object class="GtkRadioButton" id="rb_mirror_point">
<property name="label" translatable="yes">Point</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_markup" translatable="yes">The axis must pass through the
specified point.</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_toggle_pointbox" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="rb_mirror_box">
<property name="label" translatable="yes">Box</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_markup" translatable="yes">The axis cuts a box (some Geometry object
in the project) exactly in the middle.</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<property name="group">rb_mirror_point</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label87">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_markup" translatable="yes">&lt;b&gt;Point:&lt;/b&gt; Click on the desired point on the plot.
This copies the point to the clipboard. Then paste it
in the box by right-clicking and choosing paste, or
hitting Control-v.
&lt;b&gt;Box:&lt;/b&gt; Choose an object in the project
that you want to use as a box for specifying
the flipping axis. If the object is not a rectangle,
a bounding box arounf the object is calculated.</property>
<property name="xalign">1</property>
<property name="xpad">3</property>
<property name="label" translatable="yes">Point/Box:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box_pointbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label89">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_markup" translatable="yes">List of coordinates where to drill alignment
holes, in the format &lt;b&gt;(x1, y1), (x2, y2)&lt;/b&gt;, etc.
You can click on the plot and paste each
coordinate here.
All &lt;b&gt;coordinates are duplicated&lt;/b&gt; and mirrored
automatically around the axis so drill pattens are
identical when flipping your board around.</property>
<property name="xalign">1</property>
<property name="xpad">3</property>
<property name="label" translatable="yes">Algnmt holes:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_dblsided_alignholes">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label90">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_markup" translatable="yes">Diameter of the drill for
the aligment holes.</property>
<property name="xalign">1</property>
<property name="xpad">3</property>
<property name="label" translatable="yes">Drill diam.:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_dblsided_alignholediam">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box27">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="margin_top">6</property>
<property name="margin_bottom">3</property>
<child>
<object class="GtkButton" id="button19">
<property name="label" translatable="yes">Create Alignment Drill</property>
<property name="width_request">120</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_markup" translatable="yes">Creates an Excellon object with
the specified holes and their
mirror pairs.</property>
<property name="halign">end</property>
<signal name="activate" handler="on_create_aligndrill" swapped="no"/>
<signal name="clicked" handler="on_create_aligndrill" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">4</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button18">
<property name="label" translatable="yes">Mirror Object</property>
<property name="width_request">120</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_markup" translatable="yes">Mirrors the object specified in
&lt;b&gt;Bottom Layer&lt;/b&gt; around the
specified axis.</property>
<property name="halign">end</property>
<signal name="activate" handler="on_create_mirror" swapped="no"/>
<signal name="clicked" handler="on_create_mirror" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">4</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
<object class="GtkOffscreenWindow" id="offscrwindow_cncjob">
<property name="can_focus">False</property>
<child>
@@ -1145,7 +1543,6 @@ after hitting Enter in the text box.</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
<signal name="activate" handler="on_activate_name" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -2721,404 +3118,6 @@ this object.</property>
</object>
</child>
</object>
<object class="GtkOffscreenWindow" id="offscreenwindow_dblsided">
<property name="can_focus">False</property>
<child>
<object class="GtkScrolledWindow" id="sw_dblsided">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport" id="vp_dblsided">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="box_dblsided">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label53">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">6</property>
<property name="ypad">3</property>
<property name="label" translatable="yes">Double-Sided PCB Tool</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">3</property>
<property name="column_spacing">3</property>
<child>
<object class="GtkLabel" id="label84">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_markup" translatable="yes">The object that you want to flip around,
usually the Gerber object defining the
bottom copper layer. You can also flip
an Excellon object in case you want to drill
from the bottom side.</property>
<property name="xalign">1</property>
<property name="xpad">3</property>
<property name="label" translatable="yes">Bottom Layer:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="comboboxtext_bottomlayer">
<property name="width_request">200</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label85">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_markup" translatable="yes">&lt;b&gt;X&lt;/b&gt; flips from top to bottom,
&lt;b&gt;Y&lt;/b&gt; flips from left to right.</property>
<property name="xalign">1</property>
<property name="xpad">3</property>
<property name="label" translatable="yes">Mirror Axis:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box24">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">10</property>
<child>
<object class="GtkRadioButton" id="rb_mirror_x">
<property name="label" translatable="yes">X</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="rb_mirror_y">
<property name="label" translatable="yes">Y</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<property name="group">rb_mirror_x</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label86">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_markup" translatable="yes">How the location of the axis
is specified.</property>
<property name="xalign">1</property>
<property name="xpad">3</property>
<property name="label" translatable="yes">Axis location:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box25">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">10</property>
<child>
<object class="GtkRadioButton" id="rb_mirror_point">
<property name="label" translatable="yes">Point</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_markup" translatable="yes">The axis must pass through the
specified point.</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_toggle_pointbox" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="rb_mirror_box">
<property name="label" translatable="yes">Box</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_markup" translatable="yes">The axis cuts a box (some Geometry object
in the project) exactly in the middle.</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<property name="group">rb_mirror_point</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label87">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_markup" translatable="yes">&lt;b&gt;Point:&lt;/b&gt; Click on the desired point on the plot.
This copies the point to the clipboard. Then paste it
in the box by right-clicking and choosing paste, or
hitting Control-v.
&lt;b&gt;Box:&lt;/b&gt; Choose an object in the project
that you want to use as a box for specifying
the flipping axis. If the object is not a rectangle,
a bounding box arounf the object is calculated.</property>
<property name="xalign">1</property>
<property name="xpad">3</property>
<property name="label" translatable="yes">Point/Box:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box_pointbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label89">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_markup" translatable="yes">List of coordinates where to drill alignment
holes, in the format &lt;b&gt;(x1, y1), (x2, y2)&lt;/b&gt;, etc.
You can click on the plot and paste each
coordinate here.
All &lt;b&gt;coordinates are duplicated&lt;/b&gt; and mirrored
automatically around the axis so drill pattens are
identical when flipping your board around.</property>
<property name="xalign">1</property>
<property name="xpad">3</property>
<property name="label" translatable="yes">Algnmt holes:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_dblsided_alignholes">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label90">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_markup" translatable="yes">Diameter of the drill for
the aligment holes.</property>
<property name="xalign">1</property>
<property name="xpad">3</property>
<property name="label" translatable="yes">Drill diam.:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_dblsided_alignholediam">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box27">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="margin_top">6</property>
<property name="margin_bottom">3</property>
<child>
<object class="GtkButton" id="button19">
<property name="label" translatable="yes">Create Alignment Drill</property>
<property name="width_request">120</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_markup" translatable="yes">Creates an Excellon object with
the specified holes and their
mirror pairs.</property>
<property name="halign">end</property>
<signal name="activate" handler="on_create_aligndrill" swapped="no"/>
<signal name="clicked" handler="on_create_aligndrill" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">4</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button18">
<property name="label" translatable="yes">Mirror Object</property>
<property name="width_request">120</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_markup" translatable="yes">Mirrors the object specified in
&lt;b&gt;Bottom Layer&lt;/b&gt; around the
specified axis.</property>
<property name="halign">end</property>
<signal name="activate" handler="on_create_mirror" swapped="no"/>
<signal name="clicked" handler="on_create_mirror" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">4</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
<object class="GtkWindow" id="window1">
<property name="width_request">600</property>
<property name="height_request">400</property>