making standalone DTP editor

Maybe too ambitious, but I was thinking of making a tiny DTP editor with only a few traditional possibilities. InDesign etcetera have far too many possibilities but also lack some. Is it feasible? When I open my application it should have boxes for paper size, margins, font, font size, spreads or not and a few more. Too ambitious? Are there examples?

回答 (1 件)

dpb
dpb 約1時間 前

0 投票

Automated code generators are potentially useful these days...you can try the attached as starters...it's generated purely programmatically. Or, you could use its controls layout as pattern in your own AppDesigner app
function tinyDTPApp()
% 1. Create Main Figure Window
fig = uifigure('Name', 'Tiny DTP Setup', 'Position', [100, 100, 750, 450]);
% 2. Control Panel (Left Side)
controlPanel = uipanel(fig, 'Title', 'Document Settings', ...
'Position', [20, 20, 280, 410]);
% Paper Size Dropdown
uilabel(controlPanel, 'Text', 'Paper Size:', 'Position', [15, 340, 80, 22]);
paperDrop = uidropdown(controlPanel, 'Items', {'A4', 'Letter', 'A5', 'Custom'}, ...
'Position', [100, 340, 150, 22]);
% Spreads Toggle
uilabel(controlPanel, 'Text', 'Facing Pages:', 'Position', [15, 290, 80, 22]);
spreadSwitch = uiswitch(controlPanel, 'toggle', 'Items', {'Off', 'On'}, ...
'Position', [120, 290, 45, 20]);
% Margins Input
uilabel(controlPanel, 'Text', 'Margin (mm):', 'Position', [15, 240, 80, 22]);
marginEdit = uinumericeditfield(controlPanel, 'Value', 20, ...
'Position', [100, 240, 150, 22]);
% Font Family
uilabel(controlPanel, 'Text', 'Base Font:', 'Position', [15, 190, 80, 22]);
fontDrop = uidropdown(controlPanel, 'Items', {'Helvetica', 'Times', 'Courier'}, ...
'Position', [100, 190, 150, 22]);
% Font Size
uilabel(controlPanel, 'Text', 'Font Size (pt):', 'Position', [15, 140, 80, 22]);
fontSizeEdit = uinumericeditfield(controlPanel, 'Value', 12, ...
'Position', [100, 140, 150, 22]);
% 3. Preview Canvas (Right Side)
canvasPanel = uipanel(fig, 'Title', 'Page Spread Preview', ...
'Position', [320, 20, 410, 410]);
canvasAxes = uiaxes(canvasPanel, 'Position', [20, 20, 370, 350]);
axis(canvasAxes, 'equal');
canvasAxes.XColor = 'none';
canvasAxes.YColor = 'none';
% Attach Callback to update preview dynamically
updatePreview();
paperDrop.ValueChangedFcn = @(~,~) updatePreview();
spreadSwitch.ValueChangedFcn = @(~,~) updatePreview();
marginEdit.ValueChangedFcn = @(~,~) updatePreview();
% Function to draw simulated page layout
function updatePreview()
cla(canvasAxes);
isSpread = strcmp(spreadSwitch.Value, 'On');
m = marginEdit.Value / 10; % Scale down for display
% Aspect ratio box simulation
if isSpread
% Left & Right Page
rectangle(canvasAxes, 'Position', [0, 0, 10, 14], 'FaceColor', 'w', 'EdgeColor', 'k');
rectangle(canvasAxes, 'Position', [10, 0, 10, 14], 'FaceColor', 'w', 'EdgeColor', 'k');
% Margin lines
rectangle(canvasAxes, 'Position', [m, m, 10-2*m, 14-2*m], 'EdgeColor', 'r', 'LineStyle', '--');
rectangle(canvasAxes, 'Position', [10+m, m, 10-2*m, 14-2*m], 'EdgeColor', 'r', 'LineStyle', '--');
xlim(canvasAxes, [-2, 22]); ylim(canvasAxes, [-2, 16]);
else
% Single Page
rectangle(canvasAxes, 'Position', [0, 0, 10, 14], 'FaceColor', 'w', 'EdgeColor', 'k');
rectangle(canvasAxes, 'Position', [m, m, 10-2*m, 14-2*m], 'EdgeColor', 'r', 'LineStyle', '--');
xlim(canvasAxes, [-2, 12]); ylim(canvasAxes, [-2, 16]);
end
end
end

カテゴリ

ヘルプ センター および File ExchangeDevelop Apps Using App Designer についてさらに検索

タグ

質問済み:

約19時間 前

回答済み:

dpb
約16時間 前

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by