1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-29 08:43:14 +00:00
TiddlyWiki5/core/ui/EditorToolbar/size-dropdown.tid
Cameron Fischer c5ea6628f5
Trim Saga: Control panel and Editor Toolbar (#6600)
Shout out to the TiddlySpot tiddler macro for being completely broken, but also being completely unused, so no one noticed.
2022-04-06 08:27:05 +01:00

82 lines
2.0 KiB
Plaintext

title: $:/core/ui/EditorToolbar/size-dropdown
\define lingo-base() $:/language/Buttons/Size/
\define toolbar-button-size-preset(config-title)
<$set name="width" filter="$(sizePair)$ +[first[]]">
<$set name="height" filter="$(sizePair)$ +[last[]]">
<$button tag="a">
<$action-setfield
$tiddler="""$config-title$/new-width"""
$value=<<width>>
/>
<$action-setfield
$tiddler="""$config-title$/new-height"""
$value=<<height>>
/>
<$action-deletetiddler
$tiddler="""$config-title$/presets-popup"""
/>
<$text text=<<width>>/> &times; <$text text=<<height>>/>
</$button>
</$set>
</$set>
\end
\define toolbar-button-size(config-title)
\whitespace trim
''{{$:/language/Buttons/Size/Hint}}''
<<lingo Caption/Width>>&#32;<$edit-text tag="input" tiddler="""$config-title$/new-width""" default=<<tv-bitmap-editor-width>> focus="true" size="8"/>
&#32;
<<lingo Caption/Height>>&#32;<$edit-text tag="input" tiddler="""$config-title$/new-height""" default=<<tv-bitmap-editor-height>> size="8"/>
&#32;
<$button popup="""$config-title$/presets-popup""" class="tc-btn-invisible tc-popup-keep" style="width: auto; display: inline-block; background-colour: inherit;" selectedClass="tc-selected">
{{$:/core/images/down-arrow}}
</$button>
<$reveal tag="span" state="""$config-title$/presets-popup""" type="popup" position="belowleft" animate="yes">
<div class="tc-drop-down tc-popup-keep">
<$list filter={{$:/config/BitmapEditor/ImageSizes}} variable="sizePair">
<$macrocall $name="toolbar-button-size-preset" config-title="$config-title$"/>
</$list>
</div>
</$reveal>
<$button>
<$action-sendmessage
$message="tm-edit-bitmap-operation"
$param="resize"
width={{$config-title$/new-width}}
height={{$config-title$/new-height}}
/>
<$action-deletetiddler
$tiddler="""$config-title$/new-width"""
/>
<$action-deletetiddler
$tiddler="""$config-title$/new-height"""
/>
<$action-deletetiddler
$tiddler=<<dropdown-state>>
/>
<<lingo Caption/Resize>>
</$button>
\end
<$macrocall $name="toolbar-button-size" config-title=<<qualify "$:/state/Size/">>/>