Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion data/io.github.dubstar_04.design.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<color type="primary" scheme_preference="dark">#3584e4</color>
</branding>
<releases>
<release version="49.alpha1" date="2025-XX-XX">
<release version="49.alpha1" date="2026-XX-XX">
<description>
<ul>
<li>Update to GNOME 49</li>
Expand All @@ -61,6 +61,7 @@
<li>Improved Trim (TR) command with Arc, Circle and Line entities</li>
<li>Fixed how properties are filtered in the properties window</li>
<li>Allow opening multiple files from a file manager</li>
<li>Add Arc Aligned Text Command (ARCTEXT)</li>
</ul>
</description>
</release>
Expand Down
55 changes: 43 additions & 12 deletions src/Design/Properties/propertiesWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ export const PropertiesWindow = GObject.registerClass({
case 'lineWidth':
case 'scale':
case 'angle':
case 'characterSpacing':
case 'lineSpacing':
case 'startAngle':
case 'endAngle':
case 'offsetFromArc':
case 'offsetFromLeft':
case 'offsetFromRight':
case 'widthFactor':
suffixWidget = new Gtk.Entry({ valign: Gtk.Align.CENTER, text: `${value}` });
suffixWidget.width_request = widgetWidth;
const changedSignal = suffixWidget.connect('changed', () => {
Expand Down Expand Up @@ -138,7 +146,11 @@ export const PropertiesWindow = GObject.registerClass({
break;
// Boolean type properties
case 'backwards':
case 'textReversed':
case 'upsideDown':
case 'bold':
case 'underline':
case 'italic':
suffixWidget = new Gtk.Switch({ valign: Gtk.Align.CENTER, state: value });
suffixWidget.connect('notify::active', () => {
DesignCore.PropertyManager.setItemProperties(`${property}`, suffixWidget.state);
Expand Down Expand Up @@ -182,18 +194,24 @@ export const PropertiesWindow = GObject.registerClass({
case 'lineType':
case 'patternName':
case 'dimensionStyle':
case 'textAlignment':
case 'textOrientation':
case 'arcSide':
const model = this.getModel(property);
suffixWidget = Gtk.DropDown.new_from_strings(model);
suffixWidget = Gtk.DropDown.new_from_strings(model.map((item) => item.display));
suffixWidget.width_request = widgetWidth;
suffixWidget.valign = Gtk.Align.CENTER;
// get the position of the current value
const selectedIndex = model.indexOf(value);
const selectedIndex = model.findIndex((item) => item.value === value);
if (selectedIndex >= 0) {
suffixWidget.set_selected(selectedIndex);
}
suffixWidget.connect('notify::selected-item', () => {
// console.log('update style:', `${property}`, suffixWidget.get_selected_item().get_string());
DesignCore.PropertyManager.setItemProperties(`${property}`, suffixWidget.get_selected_item().get_string());
const selectedString = suffixWidget.get_selected_item().get_string();
const selectedItem = model.find((item) => item.display === selectedString);
DesignCore.PropertyManager.setItemProperties(`${property}`, selectedItem.value);
// suffixWidget.get_selected_item().get_string());
});
break;
// String type properties
Expand Down Expand Up @@ -254,41 +272,54 @@ export const PropertiesWindow = GObject.registerClass({
}
}

/**
* Return array of objects with keys: display and value
* display is the human readable name
* value is the actual value to be set
* {display: 'Display Name', value: 0'}
*/
getModel(property) {
let model = [];
switch (property) {
case 'layer':
model = [];
for (const layer of DesignCore.LayerManager.getItems()) {
model.push(layer.name);
model.push({ display: layer.name, value: layer.name });
}
break;
case 'styleName':
const styles = DesignCore.StyleManager.getItems();
const styleNames = styles.map((style) => style.name);
const styleNames = styles.map((style) => ({ display: style.name, value: style.name }));
model = styleNames;
break;
case 'dimensionStyle':
const dimSyles = DesignCore.DimStyleManager.getItems();
const dimStyleNames = dimSyles.map((style) => style.name);
const dimStyleNames = dimSyles.map((style) => ({ display: style.name, value: style.name }));
model = dimStyleNames;
break;
case 'horizontalAlignment':
// TODO: build human readable model for alignment
model = ['Left', 'Center', 'Right'];
model = [{ display: 'Left', value: 0 }, { display: 'Center', value: 1 }, { display: 'Right', value: 2 }];
break;
case 'verticalAlignment':
// TODO: build human readable model for alignment
model = ['Baseline', 'Bottom', 'Middle', 'Top'];
model = [{ display: 'Baseline', value: 0 }, { display: 'Bottom', value: 1 }, { display: 'Middle', value: 2 }, { display: 'Top', value: 3 }];
break;
case 'lineType':
const lineStyles = DesignCore.LTypeManager.getItems();
const lineStyleNames = lineStyles.map((style) => style.name);
const lineStyleNames = lineStyles.map((style) => ({ display: style.name, value: style.name }));
model = lineStyleNames;
break;
case 'patternName':
const patternNames = Object.keys(Patterns.hatch_patterns);
model = patternNames;
model = patternNames.map((patternName) => ({ display: patternName, value: patternName }));
break;
case 'textAlignment':
model = [{ display: 'Fit', value: 1 }, { display: 'Left', value: 2 }, { display: 'Right', value: 3 }, { display: 'Center', value: 4 }];
break;
case 'textOrientation':
model = [{ display: 'Outward', value: 1 }, { display: 'Inward', value: 2 }];
break;
case 'arcSide':
model = [{ display: 'Convex', value: 1 }, { display: 'Concave', value: 2 }];
break;
}
return model;
Expand Down
1 change: 1 addition & 0 deletions src/io.github.dubstar_04.design.src.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
<file>Design-Core/core/entities/polyline.js</file>
<file>Design-Core/core/entities/rectangle.js</file>
<file>Design-Core/core/entities/solid.js</file>
<file>Design-Core/core/entities/arctext.js</file>
<file>Design-Core/core/entities/text.js</file>
<!-- Tools -->
<file>Design-Core/core/tools/copy.js</file>
Expand Down