Compare commits
No commits in common. "b9163ffe390ab8b129d9cbdd87d7dd01869f8960" and "4557769cb4201e642c7c740964b1f0930e99d22a" have entirely different histories.
b9163ffe39
...
4557769cb4
@ -9,6 +9,7 @@ import "image/color"
|
|||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/nasin"
|
import "git.tebibyte.media/tomo/nasin"
|
||||||
import "git.tebibyte.media/tomo/objects"
|
import "git.tebibyte.media/tomo/objects"
|
||||||
|
import "git.tebibyte.media/tomo/tomo/theme"
|
||||||
import "git.tebibyte.media/tomo/tomo/canvas"
|
import "git.tebibyte.media/tomo/tomo/canvas"
|
||||||
import "git.tebibyte.media/tomo/objects/layouts"
|
import "git.tebibyte.media/tomo/objects/layouts"
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ func (this *Application) Init () error {
|
|||||||
} ()
|
} ()
|
||||||
|
|
||||||
window.OnClose(tomo.Stop)
|
window.OnClose(tomo.Stop)
|
||||||
window.SetVisible(true)
|
window.Show()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ func NewClockFace () *ClockFace {
|
|||||||
box := &ClockFace {
|
box := &ClockFace {
|
||||||
CanvasBox: tomo.NewCanvasBox(),
|
CanvasBox: tomo.NewCanvasBox(),
|
||||||
}
|
}
|
||||||
tomo.Apply(box, tomo.R("nasin", "ClockFace", ""))
|
theme.Apply(box, theme.R("nasin", "ClockFace", ""))
|
||||||
box.SetDrawer(box)
|
box.SetDrawer(box)
|
||||||
return box
|
return box
|
||||||
}
|
}
|
||||||
@ -88,7 +89,7 @@ func (this *ClockFace) Draw (destination canvas.Canvas) {
|
|||||||
for hour := 0; hour < 12; hour ++ {
|
for hour := 0; hour < 12; hour ++ {
|
||||||
radialLine (
|
radialLine (
|
||||||
destination,
|
destination,
|
||||||
tomo.ColorForeground,
|
theme.ColorForeground,
|
||||||
0.8, 0.9, float64(hour) / 6 * math.Pi)
|
0.8, 0.9, float64(hour) / 6 * math.Pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,9 +97,9 @@ func (this *ClockFace) Draw (destination canvas.Canvas) {
|
|||||||
minute := float64(this.time.Minute()) + second / 60
|
minute := float64(this.time.Minute()) + second / 60
|
||||||
hour := float64(this.time.Hour()) + minute / 60
|
hour := float64(this.time.Hour()) + minute / 60
|
||||||
|
|
||||||
radialLine(destination, tomo.ColorForeground, 0, 0.5, (hour - 3) / 6 * math.Pi)
|
radialLine(destination, theme.ColorForeground, 0, 0.5, (hour - 3) / 6 * math.Pi)
|
||||||
radialLine(destination, tomo.ColorForeground, 0, 0.7, (minute - 15) / 30 * math.Pi)
|
radialLine(destination, theme.ColorForeground, 0, 0.7, (minute - 15) / 30 * math.Pi)
|
||||||
radialLine(destination, tomo.ColorAccent, 0, 0.7, (second - 15) / 30 * math.Pi)
|
radialLine(destination, theme.ColorAccent, 0, 0.7, (second - 15) / 30 * math.Pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func radialLine (
|
func radialLine (
|
||||||
|
@ -6,13 +6,14 @@ import "git.tebibyte.media/tomo/tomo"
|
|||||||
import "git.tebibyte.media/tomo/nasin"
|
import "git.tebibyte.media/tomo/nasin"
|
||||||
import "git.tebibyte.media/tomo/objects"
|
import "git.tebibyte.media/tomo/objects"
|
||||||
import "git.tebibyte.media/tomo/tomo/input"
|
import "git.tebibyte.media/tomo/tomo/input"
|
||||||
|
import "git.tebibyte.media/tomo/tomo/theme"
|
||||||
import "git.tebibyte.media/tomo/objects/layouts"
|
import "git.tebibyte.media/tomo/objects/layouts"
|
||||||
|
|
||||||
const scrollIcons = true
|
const scrollIcons = true
|
||||||
|
|
||||||
type Application struct {
|
type Application struct {
|
||||||
window tomo.MainWindow
|
window tomo.Window
|
||||||
size tomo.IconSize
|
size theme.IconSize
|
||||||
grid tomo.ContainerBox
|
grid tomo.ContainerBox
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,23 +30,23 @@ func (this *Application) Init () error {
|
|||||||
this.window = window
|
this.window = window
|
||||||
|
|
||||||
this.grid = objects.NewSunkenContainer(layouts.FlowVertical)
|
this.grid = objects.NewSunkenContainer(layouts.FlowVertical)
|
||||||
this.resizeIcons(tomo.IconSizeSmall)
|
this.resizeIcons(theme.IconSizeSmall)
|
||||||
|
|
||||||
iconButtons := objects.NewInnerContainer(layouts.NewGrid([]bool { true, true, true}, []bool { false }))
|
iconButtons := objects.NewInnerContainer(layouts.NewGrid([]bool { true, true, true}, []bool { false }))
|
||||||
|
|
||||||
button := objects.NewButton("small")
|
button := objects.NewButton("small")
|
||||||
button.SetIcon(tomo.IconZoomOut)
|
button.SetIcon(theme.IconActionZoomOut)
|
||||||
button.OnClick(func () { this.resizeIcons(tomo.IconSizeSmall) })
|
button.OnClick(func () { this.resizeIcons(theme.IconSizeSmall) })
|
||||||
iconButtons.Add(button)
|
iconButtons.Add(button)
|
||||||
|
|
||||||
button = objects.NewButton("medium")
|
button = objects.NewButton("medium")
|
||||||
button.SetIcon(tomo.IconZoomOriginal)
|
button.SetIcon(theme.IconActionZoomReset)
|
||||||
button.OnClick(func () { this.resizeIcons(tomo.IconSizeMedium) })
|
button.OnClick(func () { this.resizeIcons(theme.IconSizeMedium) })
|
||||||
iconButtons.Add(button)
|
iconButtons.Add(button)
|
||||||
|
|
||||||
button = objects.NewButton("large")
|
button = objects.NewButton("large")
|
||||||
button.SetIcon(tomo.IconZoomIn)
|
button.SetIcon(theme.IconActionZoomIn)
|
||||||
button.OnClick(func () { this.resizeIcons(tomo.IconSizeLarge) })
|
button.OnClick(func () { this.resizeIcons(theme.IconSizeLarge) })
|
||||||
iconButtons.Add(button)
|
iconButtons.Add(button)
|
||||||
|
|
||||||
container := objects.NewOuterContainer (
|
container := objects.NewOuterContainer (
|
||||||
@ -63,311 +64,128 @@ func (this *Application) Init () error {
|
|||||||
window.SetRoot(container)
|
window.SetRoot(container)
|
||||||
|
|
||||||
window.OnClose(tomo.Stop)
|
window.OnClose(tomo.Stop)
|
||||||
window.SetVisible(true)
|
window.Show()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Application) resizeIcons (size tomo.IconSize) {
|
func (this *Application) resizeIcons (size theme.IconSize) {
|
||||||
this.size = size
|
this.size = size
|
||||||
this.grid.Clear()
|
this.grid.Clear()
|
||||||
icons := []tomo.Icon {
|
icons := []theme.Icon {
|
||||||
tomo.IconUnknown,
|
theme.IconUnknown,
|
||||||
tomo.IconAddressBookNew,
|
theme.IconFile,
|
||||||
tomo.IconApplicationExit,
|
theme.IconDirectory,
|
||||||
tomo.IconAppointmentNew,
|
theme.IconStorage,
|
||||||
tomo.IconCallStart,
|
theme.IconApplication,
|
||||||
tomo.IconCallStop,
|
theme.IconNetwork,
|
||||||
tomo.IconContactNew,
|
theme.IconDevice,
|
||||||
tomo.IconDialogOkay,
|
theme.IconPeripheral,
|
||||||
tomo.IconDialogCancel,
|
theme.IconPort,
|
||||||
tomo.IconEditClear,
|
theme.IconActionOpen,
|
||||||
tomo.IconEditCopy,
|
theme.IconActionOpenIn,
|
||||||
tomo.IconEditCut,
|
theme.IconActionSave,
|
||||||
tomo.IconEditDelete,
|
theme.IconActionSaveAs,
|
||||||
tomo.IconEditFind,
|
theme.IconActionPrint,
|
||||||
tomo.IconEditFindReplace,
|
theme.IconActionNew,
|
||||||
tomo.IconEditPaste,
|
theme.IconActionNewDirectory,
|
||||||
tomo.IconEditRedo,
|
theme.IconActionDelete,
|
||||||
tomo.IconEditSelectAll,
|
theme.IconActionRename,
|
||||||
tomo.IconEditUndo,
|
theme.IconActionGetInformation,
|
||||||
tomo.IconFileNew,
|
theme.IconActionChangePermissions,
|
||||||
tomo.IconDirectoryNew,
|
theme.IconActionRevert,
|
||||||
tomo.IconFileOpen,
|
theme.IconActionAdd,
|
||||||
tomo.IconFileOpenRecent,
|
theme.IconActionRemove,
|
||||||
tomo.IconFilePageSetup,
|
theme.IconActionAddBookmark,
|
||||||
tomo.IconFilePrint,
|
theme.IconActionRemoveBookmark,
|
||||||
tomo.IconFilePrintPreview,
|
theme.IconActionAddFavorite,
|
||||||
tomo.IconFilePermissions,
|
theme.IconActionRemoveFavorite,
|
||||||
tomo.IconFileProperties,
|
theme.IconActionPlay,
|
||||||
tomo.IconFileRename,
|
theme.IconActionPause,
|
||||||
tomo.IconFileRevert,
|
theme.IconActionStop,
|
||||||
tomo.IconFileSave,
|
theme.IconActionFastForward,
|
||||||
tomo.IconFileSaveAs,
|
theme.IconActionRewind,
|
||||||
tomo.IconFileSend,
|
theme.IconActionToBeginning,
|
||||||
tomo.IconFormatIndentLess,
|
theme.IconActionToEnd,
|
||||||
tomo.IconFormatIndentMore,
|
theme.IconActionRecord,
|
||||||
tomo.IconFormatAlignCenter,
|
theme.IconActionVolumeUp,
|
||||||
tomo.IconFormatAlignEven,
|
theme.IconActionVolumeDown,
|
||||||
tomo.IconFormatAlignLeft,
|
theme.IconActionMute,
|
||||||
tomo.IconFormatAlignRight,
|
theme.IconActionUndo,
|
||||||
tomo.IconFormatTextDirectionLtr,
|
theme.IconActionRedo,
|
||||||
tomo.IconFormatTextDirectionRtl,
|
theme.IconActionCut,
|
||||||
tomo.IconFormatTextBold,
|
theme.IconActionCopy,
|
||||||
tomo.IconFormatTextItalic,
|
theme.IconActionPaste,
|
||||||
tomo.IconFormatTextUnderline,
|
theme.IconActionFind,
|
||||||
tomo.IconFormatTextStrikethrough,
|
theme.IconActionReplace,
|
||||||
tomo.IconGoBottom,
|
theme.IconActionSelectAll,
|
||||||
tomo.IconGoDown,
|
theme.IconActionSelectNone,
|
||||||
tomo.IconGoFirst,
|
theme.IconActionIncrement,
|
||||||
tomo.IconGoHome,
|
theme.IconActionDecrement,
|
||||||
tomo.IconGoJump,
|
theme.IconActionClose,
|
||||||
tomo.IconGoLast,
|
theme.IconActionQuit,
|
||||||
tomo.IconGoNext,
|
theme.IconActionIconify,
|
||||||
tomo.IconGoPrevious,
|
theme.IconActionShade,
|
||||||
tomo.IconGoTop,
|
theme.IconActionMaximize,
|
||||||
tomo.IconGoUp,
|
theme.IconActionFullScreen,
|
||||||
tomo.IconHelpAbout,
|
theme.IconActionRestore,
|
||||||
tomo.IconHelpContents,
|
theme.IconActionExpand,
|
||||||
tomo.IconHelpFaq,
|
theme.IconActionContract,
|
||||||
tomo.IconInsertImage,
|
theme.IconActionBack,
|
||||||
tomo.IconInsertLink,
|
theme.IconActionForward,
|
||||||
tomo.IconInsertObject,
|
theme.IconActionUp,
|
||||||
tomo.IconInsertText,
|
theme.IconActionDown,
|
||||||
tomo.IconListAdd,
|
theme.IconActionReload,
|
||||||
tomo.IconListRemove,
|
theme.IconActionZoomIn,
|
||||||
tomo.IconMailForward,
|
theme.IconActionZoomOut,
|
||||||
tomo.IconMailMarkImportant,
|
theme.IconActionZoomReset,
|
||||||
tomo.IconMailMarkJunk,
|
theme.IconActionMove,
|
||||||
tomo.IconMailMarkNotJunk,
|
theme.IconActionResize,
|
||||||
tomo.IconMailMarkRead,
|
theme.IconActionGoTo,
|
||||||
tomo.IconMailMarkUnread,
|
theme.IconActionTransform,
|
||||||
tomo.IconMailMessageNew,
|
theme.IconActionTranslate,
|
||||||
tomo.IconMailReplyAll,
|
theme.IconActionRotate,
|
||||||
tomo.IconMailReplySender,
|
theme.IconActionScale,
|
||||||
tomo.IconMailSend,
|
theme.IconActionWarp,
|
||||||
tomo.IconMailReceive,
|
theme.IconActionCornerPin,
|
||||||
tomo.IconMediaEject,
|
theme.IconActionSelectRectangle,
|
||||||
tomo.IconMediaPlaybackPause,
|
theme.IconActionSelectEllipse,
|
||||||
tomo.IconMediaPlaybackStart,
|
theme.IconActionSelectLasso,
|
||||||
tomo.IconMediaPlaybackStop,
|
theme.IconActionSelectGeometric,
|
||||||
tomo.IconMediaRecord,
|
theme.IconActionSelectAuto,
|
||||||
tomo.IconMediaSeekBackward,
|
theme.IconActionCrop,
|
||||||
tomo.IconMediaSeekForward,
|
theme.IconActionFill,
|
||||||
tomo.IconMediaSkipBackward,
|
theme.IconActionGradient,
|
||||||
tomo.IconMediaSkipForward,
|
theme.IconActionPencil,
|
||||||
tomo.IconObjectFlipHorizontal,
|
theme.IconActionBrush,
|
||||||
tomo.IconObjectFlipVertical,
|
theme.IconActionEraser,
|
||||||
tomo.IconObjectRotateLeft,
|
theme.IconActionText,
|
||||||
tomo.IconObjectRotateRight,
|
theme.IconActionEyedropper,
|
||||||
tomo.IconProcessStop,
|
theme.IconStatusInformation,
|
||||||
tomo.IconSystemLockScreen,
|
theme.IconStatusQuestion,
|
||||||
tomo.IconSystemLogOut,
|
theme.IconStatusWarning,
|
||||||
tomo.IconSystemRun,
|
theme.IconStatusError,
|
||||||
tomo.IconSystemSearch,
|
theme.IconStatusCancel,
|
||||||
tomo.IconSystemReboot,
|
theme.IconStatusOkay,
|
||||||
tomo.IconSystemShutdown,
|
theme.IconStatusCellSignal0,
|
||||||
tomo.IconToolsCheckSpelling,
|
theme.IconStatusCellSignal1,
|
||||||
tomo.IconValueIncrement,
|
theme.IconStatusCellSignal2,
|
||||||
tomo.IconValueDecrement,
|
theme.IconStatusCellSignal3,
|
||||||
tomo.IconValueReset,
|
theme.IconStatusWirelessSignal0,
|
||||||
tomo.IconViewFullscreen,
|
theme.IconStatusWirelessSignal1,
|
||||||
tomo.IconViewRefresh,
|
theme.IconStatusWirelessSignal2,
|
||||||
tomo.IconViewRestore,
|
theme.IconStatusWirelessSignal3,
|
||||||
tomo.IconViewSortAscending,
|
theme.IconStatusBattery0,
|
||||||
tomo.IconViewSortDescending,
|
theme.IconStatusBattery1,
|
||||||
tomo.IconWindowClose,
|
theme.IconStatusBattery2,
|
||||||
tomo.IconWindowNew,
|
theme.IconStatusBattery3,
|
||||||
tomo.IconZoomFitBest,
|
theme.IconStatusBrightness0,
|
||||||
tomo.IconZoomIn,
|
theme.IconStatusBrightness1,
|
||||||
tomo.IconZoomOriginal,
|
theme.IconStatusBrightness2,
|
||||||
tomo.IconZoomOut,
|
theme.IconStatusBrightness3,
|
||||||
tomo.IconApplication,
|
theme.IconStatusVolume0,
|
||||||
tomo.IconApplicationWebBrowser,
|
theme.IconStatusVolume1,
|
||||||
tomo.IconApplicationMesssanger,
|
theme.IconStatusVolume2,
|
||||||
tomo.IconApplicationPhone,
|
theme.IconStatusVolume3,
|
||||||
tomo.IconApplicationMail,
|
|
||||||
tomo.IconApplicationTerminalEmulator,
|
|
||||||
tomo.IconApplicationFileBrowser,
|
|
||||||
tomo.IconApplicationTextEditor,
|
|
||||||
tomo.IconApplicationDocumentViewer,
|
|
||||||
tomo.IconApplicationWordProcessor,
|
|
||||||
tomo.IconApplicationSpreadsheet,
|
|
||||||
tomo.IconApplicationSlideshow,
|
|
||||||
tomo.IconApplicationCalculator,
|
|
||||||
tomo.IconApplicationPreferences,
|
|
||||||
tomo.IconApplicationProcessManager,
|
|
||||||
tomo.IconApplicationSystemInformation,
|
|
||||||
tomo.IconApplicationManual,
|
|
||||||
tomo.IconApplicationCamera,
|
|
||||||
tomo.IconApplicationImageViewer,
|
|
||||||
tomo.IconApplicationMediaPlayer,
|
|
||||||
tomo.IconApplicationImageEditor,
|
|
||||||
tomo.IconApplicationAudioEditor,
|
|
||||||
tomo.IconApplicationVideoEditor,
|
|
||||||
tomo.IconApplicationClock,
|
|
||||||
tomo.IconApplicationCalendar,
|
|
||||||
tomo.IconApplicationChecklist,
|
|
||||||
tomo.IconApplications,
|
|
||||||
tomo.IconApplicationsAccessories,
|
|
||||||
tomo.IconApplicationsDevelopment,
|
|
||||||
tomo.IconApplicationsEngineering,
|
|
||||||
tomo.IconApplicationsGames,
|
|
||||||
tomo.IconApplicationsGraphics,
|
|
||||||
tomo.IconApplicationsInternet,
|
|
||||||
tomo.IconApplicationsMultimedia,
|
|
||||||
tomo.IconApplicationsOffice,
|
|
||||||
tomo.IconApplicationsScience,
|
|
||||||
tomo.IconApplicationsSystem,
|
|
||||||
tomo.IconApplicationsUtilities,
|
|
||||||
tomo.IconPreferences,
|
|
||||||
tomo.IconPreferencesDesktop,
|
|
||||||
tomo.IconPreferencesPeripherals,
|
|
||||||
tomo.IconPreferencesPersonal,
|
|
||||||
tomo.IconPreferencesSystem,
|
|
||||||
tomo.IconPreferencesNetwork,
|
|
||||||
tomo.IconDevice,
|
|
||||||
tomo.IconDeviceCamera,
|
|
||||||
tomo.IconDeviceWebCamera,
|
|
||||||
tomo.IconDeviceComputer,
|
|
||||||
tomo.IconDevicePda,
|
|
||||||
tomo.IconDevicePhone,
|
|
||||||
tomo.IconDevicePrinter,
|
|
||||||
tomo.IconDeviceScanner,
|
|
||||||
tomo.IconDeviceMultimediaPlayer,
|
|
||||||
tomo.IconDeviceVideoDisplay,
|
|
||||||
tomo.IconDeviceAudioInput,
|
|
||||||
tomo.IconDeviceAudioOutput,
|
|
||||||
tomo.IconHardware,
|
|
||||||
tomo.IconHardwareCPU,
|
|
||||||
tomo.IconHardwareGPU,
|
|
||||||
tomo.IconHardwareRAM,
|
|
||||||
tomo.IconHardwareSoundCard,
|
|
||||||
tomo.IconHardwareNetworkAdapter,
|
|
||||||
tomo.IconPowerBattery,
|
|
||||||
tomo.IconStorageHardDisk,
|
|
||||||
tomo.IconStorageFloppyDisk,
|
|
||||||
tomo.IconStorageSolidState,
|
|
||||||
tomo.IconStorageOptical,
|
|
||||||
tomo.IconStorageFlashStick,
|
|
||||||
tomo.IconStorageFlashCard,
|
|
||||||
tomo.IconStorageMagneticTape,
|
|
||||||
tomo.IconInputGaming,
|
|
||||||
tomo.IconInputKeyboard,
|
|
||||||
tomo.IconInputMouse,
|
|
||||||
tomo.IconInputTablet,
|
|
||||||
tomo.IconNetworkWired,
|
|
||||||
tomo.IconNetworkWireless,
|
|
||||||
tomo.IconNetworkCellular,
|
|
||||||
tomo.IconNetworkLocal,
|
|
||||||
tomo.IconNetworkInternet,
|
|
||||||
tomo.IconNetworkVPN,
|
|
||||||
tomo.IconNetworkServer,
|
|
||||||
tomo.IconNetworkWorkgroup,
|
|
||||||
tomo.IconEmblemDefault,
|
|
||||||
tomo.IconEmblemEncrypted,
|
|
||||||
tomo.IconEmblemFavorite,
|
|
||||||
tomo.IconEmblemImportant,
|
|
||||||
tomo.IconEmblemReadOnly,
|
|
||||||
tomo.IconEmblemShared,
|
|
||||||
tomo.IconEmblemSymbolicLink,
|
|
||||||
tomo.IconEmblemSynchronized,
|
|
||||||
tomo.IconEmblemSystem,
|
|
||||||
tomo.IconEmblemUnreadable,
|
|
||||||
tomo.IconPlaceDirectory,
|
|
||||||
tomo.IconPlaceRemote,
|
|
||||||
tomo.IconPlaceHome,
|
|
||||||
tomo.IconPlaceDownloads,
|
|
||||||
tomo.IconPlaceDesktop,
|
|
||||||
tomo.IconPlacePhotos,
|
|
||||||
tomo.IconPlaceBooks,
|
|
||||||
tomo.IconPlaceBookmarks,
|
|
||||||
tomo.IconPlaceTrash,
|
|
||||||
tomo.IconPlaceDocuments,
|
|
||||||
tomo.IconPlaceRepositories,
|
|
||||||
tomo.IconPlaceMusic,
|
|
||||||
tomo.IconPlaceArchives,
|
|
||||||
tomo.IconPlaceFonts,
|
|
||||||
tomo.IconPlaceBinaries,
|
|
||||||
tomo.IconPlaceVideos,
|
|
||||||
tomo.IconPlace3DObjects,
|
|
||||||
tomo.IconPlaceHistory,
|
|
||||||
tomo.IconPlacePreferences,
|
|
||||||
tomo.IconCheckboxChecked,
|
|
||||||
tomo.IconCheckboxUnchecked,
|
|
||||||
tomo.IconAppointmentMissed,
|
|
||||||
tomo.IconAppointmentSoon,
|
|
||||||
tomo.IconDialogError,
|
|
||||||
tomo.IconDialogInformation,
|
|
||||||
tomo.IconDialogPassword,
|
|
||||||
tomo.IconDialogQuestion,
|
|
||||||
tomo.IconDialogWarning,
|
|
||||||
tomo.IconDirectoryDragAccept,
|
|
||||||
tomo.IconDirectoryFull,
|
|
||||||
tomo.IconDirectoryOpen,
|
|
||||||
tomo.IconDirectoryVisiting,
|
|
||||||
tomo.IconTrashFull,
|
|
||||||
tomo.IconResourceLoading,
|
|
||||||
tomo.IconResourceMissing,
|
|
||||||
tomo.IconMailAttachment,
|
|
||||||
tomo.IconMailUnread,
|
|
||||||
tomo.IconMailReplied,
|
|
||||||
tomo.IconMailSigned,
|
|
||||||
tomo.IconMailSignedVerified,
|
|
||||||
tomo.IconCellularSignal0,
|
|
||||||
tomo.IconCellularSignal1,
|
|
||||||
tomo.IconCellularSignal2,
|
|
||||||
tomo.IconCellularSignal3,
|
|
||||||
tomo.IconWirelessSignal0,
|
|
||||||
tomo.IconWirelessSignal1,
|
|
||||||
tomo.IconWirelessSignal2,
|
|
||||||
tomo.IconWirelessSignal3,
|
|
||||||
tomo.IconNetworkError,
|
|
||||||
tomo.IconNetworkIdle,
|
|
||||||
tomo.IconNetworkOffline,
|
|
||||||
tomo.IconNetworkReceive,
|
|
||||||
tomo.IconNetworkTransmit,
|
|
||||||
tomo.IconNetworkTransmitReceive,
|
|
||||||
tomo.IconPrintError,
|
|
||||||
tomo.IconPrintPrinting,
|
|
||||||
tomo.IconSecurityHigh,
|
|
||||||
tomo.IconSecurityMedium,
|
|
||||||
tomo.IconSecurityLow,
|
|
||||||
tomo.IconSoftwareUpdateAvailable,
|
|
||||||
tomo.IconSoftwareUpdateUrgent,
|
|
||||||
tomo.IconSoftwareInstalling,
|
|
||||||
tomo.IconSyncError,
|
|
||||||
tomo.IconSyncSynchronizing,
|
|
||||||
tomo.IconTaskDue,
|
|
||||||
tomo.IconTaskPastDue,
|
|
||||||
tomo.IconUserAvailable,
|
|
||||||
tomo.IconUserAway,
|
|
||||||
tomo.IconUserIdle,
|
|
||||||
tomo.IconUserOffline,
|
|
||||||
tomo.IconBattery0,
|
|
||||||
tomo.IconBattery1,
|
|
||||||
tomo.IconBattery2,
|
|
||||||
tomo.IconBattery3,
|
|
||||||
tomo.IconBrightness0,
|
|
||||||
tomo.IconBrightness1,
|
|
||||||
tomo.IconBrightness2,
|
|
||||||
tomo.IconBrightness3,
|
|
||||||
tomo.IconVolume0,
|
|
||||||
tomo.IconVolume1,
|
|
||||||
tomo.IconVolume2,
|
|
||||||
tomo.IconVolume3,
|
|
||||||
tomo.IconPlaylistRepeat,
|
|
||||||
tomo.IconPlaylistShuffle,
|
|
||||||
tomo.IconWeatherClear,
|
|
||||||
tomo.IconWeatherClearNight,
|
|
||||||
tomo.IconWeatherFewClouds,
|
|
||||||
tomo.IconWeatherFewCloudsNight,
|
|
||||||
tomo.IconWeatherFog,
|
|
||||||
tomo.IconWeatherOvercast,
|
|
||||||
tomo.IconWeatherSevereAlert,
|
|
||||||
tomo.IconWeatherShowers,
|
|
||||||
tomo.IconWeatherShowersScattered,
|
|
||||||
tomo.IconWeatherSnow,
|
|
||||||
tomo.IconWeatherStorm,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, icon := range icons {
|
for _, icon := range icons {
|
||||||
@ -381,23 +199,29 @@ func (this *Application) resizeIcons (size tomo.IconSize) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Application) iconPopup (icon tomo.Icon) error {
|
func (this *Application) iconPopup (icon theme.Icon) error {
|
||||||
popup, err := this.window.NewModal(image.Rectangle { })
|
popup, err := this.window.NewModal(image.Rectangle { })
|
||||||
if err != nil { return err }
|
if err != nil { return err }
|
||||||
|
|
||||||
if icon == "" {
|
// FIXME: remove this once https://git.tebibyte.media/tomo/tomo/issues/8
|
||||||
icon = "<UNKNOWN>"
|
// is addressed and objects.Icon makes use of it
|
||||||
|
valign := func (child tomo.Object) tomo.Object {
|
||||||
|
container := objects.NewInnerContainer (
|
||||||
|
layouts.ContractVertical,
|
||||||
|
child)
|
||||||
|
container.SetAlign(tomo.AlignMiddle, tomo.AlignMiddle)
|
||||||
|
return container
|
||||||
}
|
}
|
||||||
|
|
||||||
sizesRow := objects.NewInnerContainer (
|
sizesRow := objects.NewInnerContainer (
|
||||||
layouts.ContractHorizontal,
|
layouts.ContractHorizontal,
|
||||||
objects.NewIcon(icon, tomo.IconSizeSmall),
|
valign(objects.NewIcon(icon, theme.IconSizeSmall)),
|
||||||
objects.NewIcon(icon, tomo.IconSizeMedium),
|
valign(objects.NewIcon(icon, theme.IconSizeMedium)),
|
||||||
objects.NewIcon(icon, tomo.IconSizeLarge))
|
valign(objects.NewIcon(icon, theme.IconSizeLarge)))
|
||||||
|
|
||||||
okButton := objects.NewButton("OK")
|
okButton := objects.NewButton("OK")
|
||||||
okButton.OnClick(popup.Close)
|
okButton.OnClick(popup.Close)
|
||||||
okButton.SetIcon(tomo.IconDialogOkay)
|
okButton.SetIcon(theme.IconStatusOkay)
|
||||||
controlRow := objects.NewInnerContainer (
|
controlRow := objects.NewInnerContainer (
|
||||||
layouts.ContractHorizontal,
|
layouts.ContractHorizontal,
|
||||||
okButton)
|
okButton)
|
||||||
@ -410,7 +234,7 @@ func (this *Application) iconPopup (icon tomo.Icon) error {
|
|||||||
controlRow,
|
controlRow,
|
||||||
))
|
))
|
||||||
popup.SetTitle(string(icon) + ": Properties")
|
popup.SetTitle(string(icon) + ": Properties")
|
||||||
popup.SetVisible(true)
|
popup.Show()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import "image"
|
|||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/nasin"
|
import "git.tebibyte.media/tomo/nasin"
|
||||||
import "git.tebibyte.media/tomo/objects"
|
import "git.tebibyte.media/tomo/objects"
|
||||||
|
// import "git.tebibyte.media/tomo/tomo/theme"
|
||||||
import "git.tebibyte.media/tomo/objects/layouts"
|
import "git.tebibyte.media/tomo/objects/layouts"
|
||||||
|
|
||||||
type Application struct { }
|
type Application struct { }
|
||||||
@ -28,7 +29,7 @@ func (this *Application) Init () error {
|
|||||||
))
|
))
|
||||||
|
|
||||||
window.OnClose(tomo.Stop)
|
window.OnClose(tomo.Stop)
|
||||||
window.SetVisible(true)
|
window.Show()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import _ "embed"
|
|||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/nasin"
|
import "git.tebibyte.media/tomo/nasin"
|
||||||
import "git.tebibyte.media/tomo/objects"
|
import "git.tebibyte.media/tomo/objects"
|
||||||
|
import "git.tebibyte.media/tomo/tomo/theme"
|
||||||
import "git.tebibyte.media/tomo/objects/layouts"
|
import "git.tebibyte.media/tomo/objects/layouts"
|
||||||
|
|
||||||
//go:embed LICENSE
|
//go:embed LICENSE
|
||||||
@ -29,7 +30,7 @@ func (this *Application) Init () error {
|
|||||||
checkbox.SetFocused(true)
|
checkbox.SetFocused(true)
|
||||||
|
|
||||||
okButtok := objects.NewButton("OK")
|
okButtok := objects.NewButton("OK")
|
||||||
okButtok.SetIcon(tomo.IconDialogOkay)
|
okButtok.SetIcon(theme.IconStatusOkay)
|
||||||
okButtok.OnClick(func () {
|
okButtok.OnClick(func () {
|
||||||
if checkbox.Value() {
|
if checkbox.Value() {
|
||||||
window.Close()
|
window.Close()
|
||||||
@ -37,7 +38,7 @@ func (this *Application) Init () error {
|
|||||||
dialog, _ := objects.NewDialogOk (
|
dialog, _ := objects.NewDialogOk (
|
||||||
objects.DialogInformation, window,
|
objects.DialogInformation, window,
|
||||||
"", "You must read and agree to the license terms", nil)
|
"", "You must read and agree to the license terms", nil)
|
||||||
dialog.SetVisible(true)
|
dialog.Show()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ func (this *Application) Init () error {
|
|||||||
okButtok)))
|
okButtok)))
|
||||||
|
|
||||||
window.OnClose(tomo.Stop)
|
window.OnClose(tomo.Stop)
|
||||||
window.SetVisible(true)
|
window.Show()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
go.mod
6
go.mod
@ -3,9 +3,9 @@ module git.tebibyte.media/tomo/nasin
|
|||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.tebibyte.media/tomo/objects v0.15.0
|
git.tebibyte.media/tomo/objects v0.13.0
|
||||||
git.tebibyte.media/tomo/tomo v0.34.0
|
git.tebibyte.media/tomo/tomo v0.31.0
|
||||||
git.tebibyte.media/tomo/x v0.9.0
|
git.tebibyte.media/tomo/x v0.7.6
|
||||||
git.tebibyte.media/tomo/xdg v0.1.0
|
git.tebibyte.media/tomo/xdg v0.1.0
|
||||||
golang.org/x/image v0.11.0
|
golang.org/x/image v0.11.0
|
||||||
)
|
)
|
||||||
|
12
go.sum
12
go.sum
@ -1,12 +1,12 @@
|
|||||||
git.tebibyte.media/sashakoshka/xgbkb v1.0.0/go.mod h1:pNcE6TRO93vHd6q42SdwLSTTj25L0Yzggz7yLe0JV6Q=
|
git.tebibyte.media/sashakoshka/xgbkb v1.0.0/go.mod h1:pNcE6TRO93vHd6q42SdwLSTTj25L0Yzggz7yLe0JV6Q=
|
||||||
git.tebibyte.media/tomo/objects v0.15.0 h1:xCrRqOwCz8jDJk/sWw0B1HyrRCJafAuaPWN9nZj8V1U=
|
git.tebibyte.media/tomo/objects v0.13.0 h1:h6aC3gHEWTx4Op5M1jkmPI+GkPN9FBbQjx7zpeAhLnA=
|
||||||
git.tebibyte.media/tomo/objects v0.15.0/go.mod h1:++pM0y/xuzhgmu1RpHTWQlqrmyHLfPEF9ahyrH8Tqvk=
|
git.tebibyte.media/tomo/objects v0.13.0/go.mod h1:34UDkPEHxBgIsAYWyqqE4u1KvVtwzwdpCO6AdkgsrKo=
|
||||||
git.tebibyte.media/tomo/tomo v0.34.0 h1:r5yJPks9rtzdDI2RyAUdqa1qb6BebG0QFe2cTmcFi+0=
|
git.tebibyte.media/tomo/tomo v0.31.0 h1:LHPpj3AWycochnC8F441aaRNS6Tq6w6WnBrp/LGjyhM=
|
||||||
git.tebibyte.media/tomo/tomo v0.34.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps=
|
git.tebibyte.media/tomo/tomo v0.31.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps=
|
||||||
git.tebibyte.media/tomo/typeset v0.7.1 h1:aZrsHwCG5ZB4f5CruRFsxLv5ezJUCFUFsQJJso2sXQ8=
|
git.tebibyte.media/tomo/typeset v0.7.1 h1:aZrsHwCG5ZB4f5CruRFsxLv5ezJUCFUFsQJJso2sXQ8=
|
||||||
git.tebibyte.media/tomo/typeset v0.7.1/go.mod h1:PwDpSdBF3l/EzoIsa2ME7QffVVajnTHZN6l3MHEGe1g=
|
git.tebibyte.media/tomo/typeset v0.7.1/go.mod h1:PwDpSdBF3l/EzoIsa2ME7QffVVajnTHZN6l3MHEGe1g=
|
||||||
git.tebibyte.media/tomo/x v0.9.0 h1:wMcbK0MOE7ea7wcU2Mgrr86ZprVGLRY2PgOG0vDJR6Y=
|
git.tebibyte.media/tomo/x v0.7.6 h1:2LEfVYbIuPz4ak1gCwEYxRlUq8sLBnzNDtE8m1ozIsc=
|
||||||
git.tebibyte.media/tomo/x v0.9.0/go.mod h1:OO4PYXhzrh4ZAY12d7bg+l/P4MbkFPu6f+YVXNDRhog=
|
git.tebibyte.media/tomo/x v0.7.6/go.mod h1:8BLhXlFSTmn/y2FM+yrc6yLmMzqMhFQYYrN9SXMbmZM=
|
||||||
git.tebibyte.media/tomo/xdg v0.1.0 h1:6G2WYPPiM2IXleCpKKHuJA34BxumwNWuLsUoX3yu5zA=
|
git.tebibyte.media/tomo/xdg v0.1.0 h1:6G2WYPPiM2IXleCpKKHuJA34BxumwNWuLsUoX3yu5zA=
|
||||||
git.tebibyte.media/tomo/xdg v0.1.0/go.mod h1:tuaRwRkyYW7mqlxA7P2+V+e10KzcamNoUzcOgaIYKAY=
|
git.tebibyte.media/tomo/xdg v0.1.0/go.mod h1:tuaRwRkyYW7mqlxA7P2+V+e10KzcamNoUzcOgaIYKAY=
|
||||||
git.tebibyte.media/tomo/xgbkb v1.0.1 h1:b3HDUopjdQp1MZrb5Vpil4bOtk3NnNXtfQW27Blw2kE=
|
git.tebibyte.media/tomo/xgbkb v1.0.1 h1:b3HDUopjdQp1MZrb5Vpil4bOtk3NnNXtfQW27Blw2kE=
|
||||||
|
@ -3,10 +3,11 @@ package registrar
|
|||||||
|
|
||||||
import "git.tebibyte.media/tomo/x"
|
import "git.tebibyte.media/tomo/x"
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
|
import "git.tebibyte.media/tomo/tomo/theme"
|
||||||
import "git.tebibyte.media/tomo/nasin/internal/theme/default"
|
import "git.tebibyte.media/tomo/nasin/internal/theme/default"
|
||||||
|
|
||||||
func Init () error {
|
func Init () error {
|
||||||
tomo.SetTheme(defaultTheme.Theme())
|
theme.SetTheme(defaultTheme.Theme())
|
||||||
tomo.Register(1, x.NewBackend)
|
tomo.Register(1, x.NewBackend)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 3.5 KiB |
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 3.5 KiB |
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
@ -1,19 +1,19 @@
|
|||||||
package defaultTheme
|
package defaultTheme
|
||||||
|
|
||||||
import "image/color"
|
import "image/color"
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo/theme"
|
||||||
import dataTheme "git.tebibyte.media/tomo/nasin/internal/theme"
|
import dataTheme "git.tebibyte.media/tomo/nasin/internal/theme"
|
||||||
|
|
||||||
// Theme returns Wintergreen, the default Tomo tomo. It is neutral-gray with
|
// Theme returns Wintergreen, the default Tomo theme. It is neutral-gray with
|
||||||
// green and turquoise accents.
|
// green and turquoise accents.
|
||||||
func Theme () tomo.Theme {
|
func Theme () theme.Theme {
|
||||||
return &dataTheme.Theme {
|
return &dataTheme.Theme {
|
||||||
Colors: map[tomo.Color] color.Color {
|
Colors: map[theme.Color] color.Color {
|
||||||
tomo.ColorBackground: colorBackground,
|
theme.ColorBackground: colorBackground,
|
||||||
tomo.ColorForeground: colorForeground,
|
theme.ColorForeground: colorForeground,
|
||||||
tomo.ColorRaised: colorCarved,
|
theme.ColorRaised: colorCarved,
|
||||||
tomo.ColorSunken: colorCarved,
|
theme.ColorSunken: colorCarved,
|
||||||
tomo.ColorAccent: colorFocus,
|
theme.ColorAccent: colorFocus,
|
||||||
},
|
},
|
||||||
Rules: rules,
|
Rules: rules,
|
||||||
IconTheme: &iconTheme { },
|
IconTheme: &iconTheme { },
|
||||||
|
@ -6,6 +6,7 @@ import _ "embed"
|
|||||||
import _ "image/png"
|
import _ "image/png"
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/tomo/data"
|
import "git.tebibyte.media/tomo/tomo/data"
|
||||||
|
import "git.tebibyte.media/tomo/tomo/theme"
|
||||||
import "git.tebibyte.media/tomo/tomo/canvas"
|
import "git.tebibyte.media/tomo/tomo/canvas"
|
||||||
|
|
||||||
//go:embed assets/icons-small.png
|
//go:embed assets/icons-small.png
|
||||||
@ -13,12 +14,12 @@ var atlasSmallBytes []byte
|
|||||||
//go:embed assets/icons-large.png
|
//go:embed assets/icons-large.png
|
||||||
var atlasLargeBytes []byte
|
var atlasLargeBytes []byte
|
||||||
|
|
||||||
func generateSource (data []byte, width int) map[tomo.Icon] canvas.Texture {
|
func generateSource (data []byte, width int) map[theme.Icon] canvas.Texture {
|
||||||
atlasImage, _, err := image.Decode(bytes.NewReader(data))
|
atlasImage, _, err := image.Decode(bytes.NewReader(data))
|
||||||
if err != nil { panic(err) }
|
if err != nil { panic(err) }
|
||||||
atlasTexture := tomo.NewTexture(atlasImage)
|
atlasTexture := tomo.NewTexture(atlasImage)
|
||||||
|
|
||||||
source := make(map[tomo.Icon] canvas.Texture)
|
source := make(map[theme.Icon] canvas.Texture)
|
||||||
x := 0
|
x := 0
|
||||||
y := 0
|
y := 0
|
||||||
|
|
||||||
@ -26,8 +27,8 @@ func generateSource (data []byte, width int) map[tomo.Icon] canvas.Texture {
|
|||||||
x = 0
|
x = 0
|
||||||
y ++
|
y ++
|
||||||
}
|
}
|
||||||
col := func (id tomo.Icon) {
|
col := func (id theme.Icon) {
|
||||||
source[id] = atlasTexture.SubTexture(image.Rect (
|
source[id] = atlasTexture.Clip(image.Rect (
|
||||||
x * width,
|
x * width,
|
||||||
y * width,
|
y * width,
|
||||||
(x + 1) * width,
|
(x + 1) * width,
|
||||||
@ -35,385 +36,162 @@ func generateSource (data []byte, width int) map[tomo.Icon] canvas.Texture {
|
|||||||
x++
|
x++
|
||||||
}
|
}
|
||||||
|
|
||||||
col(tomo.IconUnknown)
|
// objects
|
||||||
col(tomo.Icon("File"))
|
col(theme.IconUnknown)
|
||||||
|
col(theme.IconFile)
|
||||||
|
col(theme.IconDirectory)
|
||||||
|
col(theme.IconStorage)
|
||||||
|
col(theme.IconApplication)
|
||||||
|
col(theme.IconNetwork)
|
||||||
|
col(theme.IconDevice)
|
||||||
|
col(theme.IconPeripheral)
|
||||||
|
col(theme.IconPort)
|
||||||
|
|
||||||
|
// actions: files
|
||||||
row()
|
row()
|
||||||
// actions
|
col(theme.IconActionOpen)
|
||||||
col(tomo.IconAddressBookNew)
|
col(theme.IconActionOpenIn)
|
||||||
col(tomo.IconApplicationExit)
|
col(theme.IconActionSave)
|
||||||
col(tomo.IconAppointmentNew)
|
col(theme.IconActionSaveAs)
|
||||||
col(tomo.IconCallStart)
|
col(theme.IconActionPrint)
|
||||||
col(tomo.IconCallStop)
|
col(theme.IconActionNew)
|
||||||
col(tomo.IconContactNew)
|
col(theme.IconActionNewDirectory)
|
||||||
// actions: dialog
|
col(theme.IconActionDelete)
|
||||||
col(tomo.IconDialogOkay)
|
col(theme.IconActionRename)
|
||||||
col(tomo.IconDialogCancel)
|
col(theme.IconActionGetInformation)
|
||||||
// actions: edit
|
col(theme.IconActionChangePermissions)
|
||||||
col(tomo.IconEditClear)
|
col(theme.IconActionRevert)
|
||||||
col(tomo.IconEditCopy)
|
|
||||||
col(tomo.IconEditCut)
|
|
||||||
col(tomo.IconEditDelete)
|
|
||||||
col(tomo.IconEditFind)
|
|
||||||
col(tomo.IconEditFindReplace)
|
|
||||||
col(tomo.IconEditPaste)
|
|
||||||
col(tomo.IconEditRedo)
|
|
||||||
col(tomo.IconEditSelectAll)
|
|
||||||
col(tomo.IconEditUndo)
|
|
||||||
// actions: file
|
|
||||||
col(tomo.IconFileNew)
|
|
||||||
col(tomo.IconDirectoryNew)
|
|
||||||
col(tomo.IconFileOpen)
|
|
||||||
col(tomo.IconFileOpenRecent)
|
|
||||||
col(tomo.IconFilePageSetup)
|
|
||||||
col(tomo.IconFilePrint)
|
|
||||||
col(tomo.IconFilePrintPreview)
|
|
||||||
col(tomo.IconFilePermissions)
|
|
||||||
col(tomo.IconFileProperties)
|
|
||||||
col(tomo.IconFileRename)
|
|
||||||
col(tomo.IconFileRevert)
|
|
||||||
col(tomo.IconFileSave)
|
|
||||||
col(tomo.IconFileSaveAs)
|
|
||||||
col(tomo.IconFileSend)
|
|
||||||
|
|
||||||
|
// actions: list management
|
||||||
row()
|
row()
|
||||||
// actions: format
|
col(theme.IconActionAdd)
|
||||||
col(tomo.IconFormatIndentLess)
|
col(theme.IconActionRemove)
|
||||||
col(tomo.IconFormatIndentMore)
|
col(theme.IconActionAddBookmark)
|
||||||
col(tomo.IconFormatAlignCenter)
|
col(theme.IconActionRemoveBookmark)
|
||||||
col(tomo.IconFormatAlignEven)
|
col(theme.IconActionAddFavorite)
|
||||||
col(tomo.IconFormatAlignLeft)
|
col(theme.IconActionRemoveFavorite)
|
||||||
col(tomo.IconFormatAlignRight)
|
|
||||||
col(tomo.IconFormatTextDirectionLtr)
|
|
||||||
col(tomo.IconFormatTextDirectionRtl)
|
|
||||||
col(tomo.IconFormatTextBold)
|
|
||||||
col(tomo.IconFormatTextItalic)
|
|
||||||
col(tomo.IconFormatTextUnderline)
|
|
||||||
col(tomo.IconFormatTextStrikethrough)
|
|
||||||
// actions: go
|
|
||||||
col(tomo.IconGoBottom)
|
|
||||||
col(tomo.IconGoDown)
|
|
||||||
col(tomo.IconGoFirst)
|
|
||||||
col(tomo.IconGoHome)
|
|
||||||
col(tomo.IconGoJump)
|
|
||||||
col(tomo.IconGoLast)
|
|
||||||
col(tomo.IconGoNext)
|
|
||||||
col(tomo.IconGoPrevious)
|
|
||||||
col(tomo.IconGoTop)
|
|
||||||
col(tomo.IconGoUp)
|
|
||||||
// actions: help
|
|
||||||
col(tomo.IconHelpAbout)
|
|
||||||
col(tomo.IconHelpContents)
|
|
||||||
col(tomo.IconHelpFaq)
|
|
||||||
// actions: insert
|
|
||||||
col(tomo.IconInsertImage)
|
|
||||||
col(tomo.IconInsertLink)
|
|
||||||
col(tomo.IconInsertObject)
|
|
||||||
col(tomo.IconInsertText)
|
|
||||||
// actions: list
|
|
||||||
col(tomo.IconListAdd)
|
|
||||||
col(tomo.IconListRemove)
|
|
||||||
|
|
||||||
row()
|
|
||||||
// actions: mail
|
|
||||||
col(tomo.IconMailForward)
|
|
||||||
col(tomo.IconMailMarkImportant)
|
|
||||||
col(tomo.IconMailMarkJunk)
|
|
||||||
col(tomo.IconMailMarkNotJunk)
|
|
||||||
col(tomo.IconMailMarkRead)
|
|
||||||
col(tomo.IconMailMarkUnread)
|
|
||||||
col(tomo.IconMailMessageNew)
|
|
||||||
col(tomo.IconMailReplyAll)
|
|
||||||
col(tomo.IconMailReplySender)
|
|
||||||
col(tomo.IconMailSend)
|
|
||||||
col(tomo.IconMailReceive)
|
|
||||||
// actions: media
|
// actions: media
|
||||||
col(tomo.IconMediaEject)
|
|
||||||
col(tomo.IconMediaPlaybackPause)
|
|
||||||
col(tomo.IconMediaPlaybackStart)
|
|
||||||
col(tomo.IconMediaPlaybackStop)
|
|
||||||
col(tomo.IconMediaRecord)
|
|
||||||
col(tomo.IconMediaSeekBackward)
|
|
||||||
col(tomo.IconMediaSeekForward)
|
|
||||||
col(tomo.IconMediaSkipBackward)
|
|
||||||
col(tomo.IconMediaSkipForward)
|
|
||||||
// actions: object
|
|
||||||
col(tomo.IconObjectFlipHorizontal)
|
|
||||||
col(tomo.IconObjectFlipVertical)
|
|
||||||
col(tomo.IconObjectRotateLeft)
|
|
||||||
col(tomo.IconObjectRotateRight)
|
|
||||||
// actions: process
|
|
||||||
col(tomo.IconProcessStop)
|
|
||||||
// actions: system
|
|
||||||
col(tomo.IconSystemLockScreen)
|
|
||||||
col(tomo.IconSystemLogOut)
|
|
||||||
col(tomo.IconSystemRun)
|
|
||||||
col(tomo.IconSystemSearch)
|
|
||||||
col(tomo.IconSystemReboot)
|
|
||||||
col(tomo.IconSystemShutdown)
|
|
||||||
|
|
||||||
row()
|
row()
|
||||||
// actions: tools
|
col(theme.IconActionPlay)
|
||||||
col(tomo.IconToolsCheckSpelling)
|
col(theme.IconActionPause)
|
||||||
// actions: value
|
col(theme.IconActionStop)
|
||||||
col(tomo.IconValueIncrement)
|
col(theme.IconActionFastForward)
|
||||||
col(tomo.IconValueDecrement)
|
col(theme.IconActionRewind)
|
||||||
col(tomo.IconValueReset)
|
col(theme.IconActionToBeginning)
|
||||||
// actions: view
|
col(theme.IconActionToEnd)
|
||||||
col(tomo.IconViewFullscreen)
|
col(theme.IconActionRecord)
|
||||||
col(tomo.IconViewRefresh)
|
col(theme.IconActionVolumeUp)
|
||||||
col(tomo.IconViewRestore)
|
col(theme.IconActionVolumeDown)
|
||||||
col(tomo.IconViewSortAscending)
|
col(theme.IconActionMute)
|
||||||
col(tomo.IconViewSortDescending)
|
|
||||||
// actions: window
|
|
||||||
col(tomo.IconWindowClose)
|
|
||||||
col(tomo.IconWindowNew)
|
|
||||||
// actions: zoom
|
|
||||||
col(tomo.IconZoomFitBest)
|
|
||||||
col(tomo.IconZoomIn)
|
|
||||||
col(tomo.IconZoomOriginal)
|
|
||||||
col(tomo.IconZoomOut)
|
|
||||||
|
|
||||||
|
// actions: editing
|
||||||
row()
|
row()
|
||||||
// applications
|
col(theme.IconActionUndo)
|
||||||
// Keep these in sync with nasin.ApplicationRole!
|
col(theme.IconActionRedo)
|
||||||
col(tomo.IconApplication)
|
col(theme.IconActionCut)
|
||||||
col(tomo.IconApplicationWebBrowser)
|
col(theme.IconActionCopy)
|
||||||
col(tomo.IconApplicationMesssanger)
|
col(theme.IconActionPaste)
|
||||||
col(tomo.IconApplicationPhone)
|
col(theme.IconActionFind)
|
||||||
col(tomo.IconApplicationMail)
|
col(theme.IconActionReplace)
|
||||||
col(tomo.IconApplicationTerminalEmulator)
|
col(theme.IconActionSelectAll)
|
||||||
col(tomo.IconApplicationFileBrowser)
|
col(theme.IconActionSelectNone)
|
||||||
col(tomo.IconApplicationTextEditor)
|
col(theme.IconActionIncrement)
|
||||||
col(tomo.IconApplicationDocumentViewer)
|
col(theme.IconActionDecrement)
|
||||||
col(tomo.IconApplicationWordProcessor)
|
|
||||||
col(tomo.IconApplicationSpreadsheet)
|
|
||||||
col(tomo.IconApplicationSlideshow)
|
|
||||||
col(tomo.IconApplicationCalculator)
|
|
||||||
col(tomo.IconApplicationPreferences)
|
|
||||||
col(tomo.IconApplicationProcessManager)
|
|
||||||
col(tomo.IconApplicationSystemInformation)
|
|
||||||
col(tomo.IconApplicationManual)
|
|
||||||
col(tomo.IconApplicationCamera)
|
|
||||||
col(tomo.IconApplicationImageViewer)
|
|
||||||
col(tomo.IconApplicationMediaPlayer)
|
|
||||||
col(tomo.IconApplicationImageEditor)
|
|
||||||
col(tomo.IconApplicationAudioEditor)
|
|
||||||
col(tomo.IconApplicationVideoEditor)
|
|
||||||
col(tomo.IconApplicationClock)
|
|
||||||
col(tomo.IconApplicationCalendar)
|
|
||||||
col(tomo.IconApplicationChecklist)
|
|
||||||
|
|
||||||
row()
|
|
||||||
// categories: applications
|
|
||||||
col(tomo.IconApplications)
|
|
||||||
col(tomo.IconApplicationsAccessories)
|
|
||||||
col(tomo.IconApplicationsDevelopment)
|
|
||||||
col(tomo.IconApplicationsEngineering)
|
|
||||||
col(tomo.IconApplicationsGames)
|
|
||||||
col(tomo.IconApplicationsGraphics)
|
|
||||||
col(tomo.IconApplicationsInternet)
|
|
||||||
col(tomo.IconApplicationsMultimedia)
|
|
||||||
col(tomo.IconApplicationsOffice)
|
|
||||||
col(tomo.IconApplicationsScience)
|
|
||||||
col(tomo.IconApplicationsSystem)
|
|
||||||
col(tomo.IconApplicationsUtilities)
|
|
||||||
// categories: preferences
|
|
||||||
col(tomo.IconPreferences)
|
|
||||||
col(tomo.IconPreferencesDesktop)
|
|
||||||
col(tomo.IconPreferencesPeripherals)
|
|
||||||
col(tomo.IconPreferencesPersonal)
|
|
||||||
col(tomo.IconPreferencesSystem)
|
|
||||||
col(tomo.IconPreferencesNetwork)
|
|
||||||
|
|
||||||
row()
|
|
||||||
// devices
|
|
||||||
col(tomo.IconDevice)
|
|
||||||
col(tomo.IconDeviceCamera)
|
|
||||||
col(tomo.IconDeviceWebCamera)
|
|
||||||
col(tomo.IconDeviceComputer)
|
|
||||||
col(tomo.IconDevicePda)
|
|
||||||
col(tomo.IconDevicePhone)
|
|
||||||
col(tomo.IconDevicePrinter)
|
|
||||||
col(tomo.IconDeviceScanner)
|
|
||||||
col(tomo.IconDeviceMultimediaPlayer)
|
|
||||||
col(tomo.IconDeviceVideoDisplay)
|
|
||||||
col(tomo.IconDeviceAudioInput)
|
|
||||||
col(tomo.IconDeviceAudioOutput)
|
|
||||||
// devices: hardware
|
|
||||||
col(tomo.IconHardware)
|
|
||||||
col(tomo.IconHardwareCPU)
|
|
||||||
col(tomo.IconHardwareGPU)
|
|
||||||
col(tomo.IconHardwareRAM)
|
|
||||||
col(tomo.IconHardwareSoundCard)
|
|
||||||
col(tomo.IconHardwareNetworkAdapter)
|
|
||||||
// devices: power
|
|
||||||
col(tomo.IconPowerBattery)
|
|
||||||
// devices: storage
|
|
||||||
col(tomo.IconStorageHardDisk)
|
|
||||||
col(tomo.IconStorageFloppyDisk)
|
|
||||||
col(tomo.IconStorageSolidState)
|
|
||||||
col(tomo.IconStorageOptical)
|
|
||||||
col(tomo.IconStorageFlashStick)
|
|
||||||
col(tomo.IconStorageFlashCard)
|
|
||||||
col(tomo.IconStorageMagneticTape)
|
|
||||||
// devices: input
|
|
||||||
col(tomo.IconInputGaming)
|
|
||||||
col(tomo.IconInputKeyboard)
|
|
||||||
col(tomo.IconInputMouse)
|
|
||||||
col(tomo.IconInputTablet)
|
|
||||||
|
|
||||||
row()
|
|
||||||
// devices: network
|
|
||||||
col(tomo.IconNetworkWired)
|
|
||||||
col(tomo.IconNetworkWireless)
|
|
||||||
col(tomo.IconNetworkCellular)
|
|
||||||
col(tomo.IconNetworkLocal)
|
|
||||||
col(tomo.IconNetworkInternet)
|
|
||||||
col(tomo.IconNetworkVPN)
|
|
||||||
col(tomo.IconNetworkServer)
|
|
||||||
col(tomo.IconNetworkWorkgroup)
|
|
||||||
|
|
||||||
row()
|
|
||||||
// emblems
|
|
||||||
col(tomo.IconEmblemDefault)
|
|
||||||
col(tomo.IconEmblemEncrypted)
|
|
||||||
col(tomo.IconEmblemFavorite)
|
|
||||||
col(tomo.IconEmblemImportant)
|
|
||||||
col(tomo.IconEmblemReadOnly)
|
|
||||||
col(tomo.IconEmblemShared)
|
|
||||||
col(tomo.IconEmblemSymbolicLink)
|
|
||||||
col(tomo.IconEmblemSynchronized)
|
|
||||||
col(tomo.IconEmblemSystem)
|
|
||||||
col(tomo.IconEmblemUnreadable)
|
|
||||||
|
|
||||||
row()
|
|
||||||
// places
|
|
||||||
col(tomo.IconPlaceDirectory)
|
|
||||||
col(tomo.IconPlaceRemote)
|
|
||||||
col(tomo.IconPlaceHome)
|
|
||||||
col(tomo.IconPlaceDownloads)
|
|
||||||
col(tomo.IconPlaceDesktop)
|
|
||||||
col(tomo.IconPlacePhotos)
|
|
||||||
col(tomo.IconPlaceBooks)
|
|
||||||
col(tomo.IconPlaceBookmarks)
|
|
||||||
col(tomo.IconPlaceTrash)
|
|
||||||
col(tomo.IconPlaceDocuments)
|
|
||||||
col(tomo.IconPlaceRepositories)
|
|
||||||
col(tomo.IconPlaceMusic)
|
|
||||||
col(tomo.IconPlaceArchives)
|
|
||||||
col(tomo.IconPlaceFonts)
|
|
||||||
col(tomo.IconPlaceBinaries)
|
|
||||||
col(tomo.IconPlaceVideos)
|
|
||||||
col(tomo.IconPlace3DObjects)
|
|
||||||
col(tomo.IconPlaceHistory)
|
|
||||||
col(tomo.IconPlacePreferences)
|
|
||||||
|
|
||||||
row()
|
|
||||||
// status: checkbox
|
|
||||||
col(tomo.IconCheckboxChecked)
|
|
||||||
col(tomo.IconCheckboxUnchecked)
|
|
||||||
// status: appointments
|
|
||||||
col(tomo.IconAppointmentMissed)
|
|
||||||
col(tomo.IconAppointmentSoon)
|
|
||||||
// status: dialogs
|
|
||||||
col(tomo.IconDialogError)
|
|
||||||
col(tomo.IconDialogInformation)
|
|
||||||
col(tomo.IconDialogPassword)
|
|
||||||
col(tomo.IconDialogQuestion)
|
|
||||||
col(tomo.IconDialogWarning)
|
|
||||||
// status: directories
|
|
||||||
col(tomo.IconDirectoryDragAccept)
|
|
||||||
col(tomo.IconDirectoryFull)
|
|
||||||
col(tomo.IconDirectoryOpen)
|
|
||||||
col(tomo.IconDirectoryVisiting)
|
|
||||||
// status: trash
|
|
||||||
col(tomo.IconTrashFull)
|
|
||||||
// status: resource
|
|
||||||
col(tomo.IconResourceLoading)
|
|
||||||
col(tomo.IconResourceMissing)
|
|
||||||
// status: mail
|
|
||||||
col(tomo.IconMailAttachment)
|
|
||||||
col(tomo.IconMailUnread)
|
|
||||||
col(tomo.IconMailReplied)
|
|
||||||
col(tomo.IconMailSigned)
|
|
||||||
col(tomo.IconMailSignedVerified)
|
|
||||||
|
|
||||||
row()
|
|
||||||
// status: network
|
|
||||||
col(tomo.IconCellularSignal0)
|
|
||||||
col(tomo.IconCellularSignal1)
|
|
||||||
col(tomo.IconCellularSignal2)
|
|
||||||
col(tomo.IconCellularSignal3)
|
|
||||||
col(tomo.IconWirelessSignal0)
|
|
||||||
col(tomo.IconWirelessSignal1)
|
|
||||||
col(tomo.IconWirelessSignal2)
|
|
||||||
col(tomo.IconWirelessSignal3)
|
|
||||||
col(tomo.IconNetworkError)
|
|
||||||
col(tomo.IconNetworkIdle)
|
|
||||||
col(tomo.IconNetworkOffline)
|
|
||||||
col(tomo.IconNetworkReceive)
|
|
||||||
col(tomo.IconNetworkTransmit)
|
|
||||||
col(tomo.IconNetworkTransmitReceive)
|
|
||||||
// status: print
|
|
||||||
col(tomo.IconPrintError)
|
|
||||||
col(tomo.IconPrintPrinting)
|
|
||||||
// status: security
|
|
||||||
col(tomo.IconSecurityHigh)
|
|
||||||
col(tomo.IconSecurityMedium)
|
|
||||||
col(tomo.IconSecurityLow)
|
|
||||||
// status: software
|
|
||||||
col(tomo.IconSoftwareUpdateAvailable)
|
|
||||||
col(tomo.IconSoftwareUpdateUrgent)
|
|
||||||
col(tomo.IconSoftwareInstalling)
|
|
||||||
// status: sync
|
|
||||||
col(tomo.IconSyncError)
|
|
||||||
col(tomo.IconSyncSynchronizing)
|
|
||||||
// status: tasks
|
|
||||||
col(tomo.IconTaskDue)
|
|
||||||
col(tomo.IconTaskPastDue)
|
|
||||||
// status: users
|
|
||||||
col(tomo.IconUserAvailable)
|
|
||||||
col(tomo.IconUserAway)
|
|
||||||
col(tomo.IconUserIdle)
|
|
||||||
col(tomo.IconUserOffline)
|
|
||||||
|
|
||||||
row()
|
|
||||||
// status: power
|
|
||||||
col(tomo.IconBattery0)
|
|
||||||
col(tomo.IconBattery1)
|
|
||||||
col(tomo.IconBattery2)
|
|
||||||
col(tomo.IconBattery3)
|
|
||||||
col(tomo.IconBrightness0)
|
|
||||||
col(tomo.IconBrightness1)
|
|
||||||
col(tomo.IconBrightness2)
|
|
||||||
col(tomo.IconBrightness3)
|
|
||||||
// status: media
|
|
||||||
col(tomo.IconVolume0)
|
|
||||||
col(tomo.IconVolume1)
|
|
||||||
col(tomo.IconVolume2)
|
|
||||||
col(tomo.IconVolume3)
|
|
||||||
col(tomo.IconPlaylistRepeat)
|
|
||||||
col(tomo.IconPlaylistShuffle)
|
|
||||||
// status: weather
|
|
||||||
col(tomo.IconWeatherClear)
|
|
||||||
col(tomo.IconWeatherClearNight)
|
|
||||||
col(tomo.IconWeatherFewClouds)
|
|
||||||
col(tomo.IconWeatherFewCloudsNight)
|
|
||||||
col(tomo.IconWeatherFog)
|
|
||||||
col(tomo.IconWeatherOvercast)
|
|
||||||
col(tomo.IconWeatherSevereAlert)
|
|
||||||
col(tomo.IconWeatherShowers)
|
|
||||||
col(tomo.IconWeatherShowersScattered)
|
|
||||||
col(tomo.IconWeatherSnow)
|
|
||||||
col(tomo.IconWeatherStorm)
|
|
||||||
|
|
||||||
|
// actions: window management
|
||||||
|
row()
|
||||||
|
col(theme.IconActionClose)
|
||||||
|
col(theme.IconActionQuit)
|
||||||
|
col(theme.IconActionIconify)
|
||||||
|
col(theme.IconActionShade)
|
||||||
|
col(theme.IconActionMaximize)
|
||||||
|
col(theme.IconActionFullScreen)
|
||||||
|
col(theme.IconActionRestore)
|
||||||
|
|
||||||
|
// actions: view
|
||||||
|
row()
|
||||||
|
col(theme.IconActionExpand)
|
||||||
|
col(theme.IconActionContract)
|
||||||
|
col(theme.IconActionBack)
|
||||||
|
col(theme.IconActionForward)
|
||||||
|
col(theme.IconActionUp)
|
||||||
|
col(theme.IconActionDown)
|
||||||
|
col(theme.IconActionReload)
|
||||||
|
col(theme.IconActionZoomIn)
|
||||||
|
col(theme.IconActionZoomOut)
|
||||||
|
col(theme.IconActionZoomReset)
|
||||||
|
col(theme.IconActionMove)
|
||||||
|
col(theme.IconActionResize)
|
||||||
|
col(theme.IconActionGoTo)
|
||||||
|
|
||||||
|
// actions: tools
|
||||||
|
row()
|
||||||
|
col(theme.IconActionTransform)
|
||||||
|
col(theme.IconActionTranslate)
|
||||||
|
col(theme.IconActionRotate)
|
||||||
|
col(theme.IconActionScale)
|
||||||
|
col(theme.IconActionWarp)
|
||||||
|
col(theme.IconActionCornerPin)
|
||||||
|
col(theme.IconActionSelectRectangle)
|
||||||
|
col(theme.IconActionSelectEllipse)
|
||||||
|
col(theme.IconActionSelectLasso)
|
||||||
|
col(theme.IconActionSelectGeometric)
|
||||||
|
col(theme.IconActionSelectAuto)
|
||||||
|
col(theme.IconActionCrop)
|
||||||
|
col(theme.IconActionFill)
|
||||||
|
row()
|
||||||
|
col(theme.IconActionGradient)
|
||||||
|
col(theme.IconActionPencil)
|
||||||
|
col(theme.IconActionBrush)
|
||||||
|
col(theme.IconActionEraser)
|
||||||
|
col(theme.IconActionText)
|
||||||
|
col(theme.IconActionEyedropper)
|
||||||
|
|
||||||
|
// status: dialog
|
||||||
|
row()
|
||||||
|
col(theme.IconStatusInformation)
|
||||||
|
col(theme.IconStatusQuestion)
|
||||||
|
col(theme.IconStatusWarning)
|
||||||
|
col(theme.IconStatusError)
|
||||||
|
col(theme.IconStatusCancel)
|
||||||
|
col(theme.IconStatusOkay)
|
||||||
|
|
||||||
|
// status: network
|
||||||
|
row()
|
||||||
|
col(theme.IconStatusCellSignal0)
|
||||||
|
col(theme.IconStatusCellSignal1)
|
||||||
|
col(theme.IconStatusCellSignal2)
|
||||||
|
col(theme.IconStatusCellSignal3)
|
||||||
|
col(theme.IconStatusWirelessSignal0)
|
||||||
|
col(theme.IconStatusWirelessSignal1)
|
||||||
|
col(theme.IconStatusWirelessSignal2)
|
||||||
|
col(theme.IconStatusWirelessSignal3)
|
||||||
|
|
||||||
|
// status: power
|
||||||
|
row()
|
||||||
|
col(theme.IconStatusBattery0)
|
||||||
|
col(theme.IconStatusBattery1)
|
||||||
|
col(theme.IconStatusBattery2)
|
||||||
|
col(theme.IconStatusBattery3)
|
||||||
|
col(theme.IconStatusBrightness0)
|
||||||
|
col(theme.IconStatusBrightness1)
|
||||||
|
col(theme.IconStatusBrightness2)
|
||||||
|
col(theme.IconStatusBrightness3)
|
||||||
|
|
||||||
|
// status: media
|
||||||
|
row()
|
||||||
|
col(theme.IconStatusVolume0)
|
||||||
|
col(theme.IconStatusVolume1)
|
||||||
|
col(theme.IconStatusVolume2)
|
||||||
|
col(theme.IconStatusVolume3)
|
||||||
|
|
||||||
return source
|
return source
|
||||||
}
|
}
|
||||||
|
|
||||||
type iconTheme struct {
|
type iconTheme struct {
|
||||||
texturesSmall map[tomo.Icon] canvas.Texture
|
texturesSmall map[theme.Icon] canvas.Texture
|
||||||
texturesLarge map[tomo.Icon] canvas.Texture
|
texturesLarge map[theme.Icon] canvas.Texture
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *iconTheme) ensure () {
|
func (this *iconTheme) ensure () {
|
||||||
@ -422,29 +200,29 @@ func (this *iconTheme) ensure () {
|
|||||||
this.texturesLarge = generateSource(atlasLargeBytes, 32)
|
this.texturesLarge = generateSource(atlasLargeBytes, 32)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *iconTheme) selectSource (size tomo.IconSize) map[tomo.Icon] canvas.Texture {
|
func (this *iconTheme) selectSource (size theme.IconSize) map[theme.Icon] canvas.Texture {
|
||||||
if size == tomo.IconSizeSmall {
|
if size == theme.IconSizeSmall {
|
||||||
return this.texturesSmall
|
return this.texturesSmall
|
||||||
} else {
|
} else {
|
||||||
return this.texturesLarge
|
return this.texturesLarge
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *iconTheme) Icon (icon tomo.Icon, size tomo.IconSize) canvas.Texture {
|
func (this *iconTheme) Icon (icon theme.Icon, size theme.IconSize) canvas.Texture {
|
||||||
this.ensure()
|
this.ensure()
|
||||||
source := this.selectSource(size)
|
source := this.selectSource(size)
|
||||||
if texture, ok := source[icon]; ok {
|
if texture, ok := source[icon]; ok {
|
||||||
return texture
|
return texture
|
||||||
}
|
}
|
||||||
return source[tomo.IconUnknown]
|
return source[theme.IconUnknown]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *iconTheme) MimeIcon (mime data.Mime, size tomo.IconSize) canvas.Texture {
|
func (this *iconTheme) MimeIcon (mime data.Mime, size theme.IconSize) canvas.Texture {
|
||||||
this.ensure()
|
this.ensure()
|
||||||
source := this.selectSource(size)
|
source := this.selectSource(size)
|
||||||
if mime == data.M("inode", "directory") {
|
if mime == data.M("inode", "directory") {
|
||||||
return source[tomo.IconPlaceDirectory]
|
return source[theme.IconDirectory]
|
||||||
} else {
|
} else {
|
||||||
return source[tomo.Icon("File")]
|
return source[theme.IconFile]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package defaultTheme
|
|||||||
import "image/color"
|
import "image/color"
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "golang.org/x/image/font/basicfont"
|
import "golang.org/x/image/font/basicfont"
|
||||||
|
import "git.tebibyte.media/tomo/tomo/theme"
|
||||||
import dataTheme "git.tebibyte.media/tomo/nasin/internal/theme"
|
import dataTheme "git.tebibyte.media/tomo/nasin/internal/theme"
|
||||||
|
|
||||||
var colorFocus = color.RGBA { R: 61, G: 128, B: 143, A: 255 }
|
var colorFocus = color.RGBA { R: 61, G: 128, B: 143, A: 255 }
|
||||||
@ -37,15 +38,15 @@ var rules = []dataTheme.Rule {
|
|||||||
dataTheme.Rule {
|
dataTheme.Rule {
|
||||||
Default: dataTheme.AS (
|
Default: dataTheme.AS (
|
||||||
dataTheme.AttrFace { Face: basicfont.Face7x13 },
|
dataTheme.AttrFace { Face: basicfont.Face7x13 },
|
||||||
dataTheme.AttrTextColor { Color: tomo.ColorForeground },
|
dataTheme.AttrTextColor { Color: theme.ColorForeground },
|
||||||
dataTheme.AttrDotColor { Color: tomo.ColorAccent },
|
dataTheme.AttrDotColor { Color: theme.ColorAccent },
|
||||||
dataTheme.AttrGap { X: 8, Y: 8 },
|
dataTheme.AttrGap { X: 8, Y: 8 },
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
// *.Button[*]
|
// *.Button[*]
|
||||||
dataTheme.Rule {
|
dataTheme.Rule {
|
||||||
Role: tomo.R("", "Button", ""),
|
Role: theme.R("", "Button", ""),
|
||||||
Default: dataTheme.AS (
|
Default: dataTheme.AS (
|
||||||
dataTheme.AttrBorder {
|
dataTheme.AttrBorder {
|
||||||
outline,
|
outline,
|
||||||
@ -55,7 +56,7 @@ var rules = []dataTheme.Rule {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
dataTheme.AttrPadding(tomo.I(4, 8)),
|
dataTheme.AttrPadding(tomo.I(4, 8)),
|
||||||
dataTheme.AttrColor { Color: tomo.ColorRaised },
|
dataTheme.AttrColor { Color: theme.ColorRaised },
|
||||||
),
|
),
|
||||||
Pressed: dataTheme.AS (
|
Pressed: dataTheme.AS (
|
||||||
dataTheme.AttrBorder {
|
dataTheme.AttrBorder {
|
||||||
@ -82,7 +83,7 @@ var rules = []dataTheme.Rule {
|
|||||||
|
|
||||||
// *.TextInput[*]
|
// *.TextInput[*]
|
||||||
dataTheme.Rule {
|
dataTheme.Rule {
|
||||||
Role: tomo.R("", "TextInput", ""),
|
Role: theme.R("", "TextInput", ""),
|
||||||
Default: dataTheme.AS (
|
Default: dataTheme.AS (
|
||||||
dataTheme.AttrBorder {
|
dataTheme.AttrBorder {
|
||||||
outline,
|
outline,
|
||||||
@ -107,7 +108,7 @@ var rules = []dataTheme.Rule {
|
|||||||
|
|
||||||
// *.TextView[*]
|
// *.TextView[*]
|
||||||
dataTheme.Rule {
|
dataTheme.Rule {
|
||||||
Role: tomo.R("", "TextView", ""),
|
Role: theme.R("", "TextView", ""),
|
||||||
Default: dataTheme.AS (
|
Default: dataTheme.AS (
|
||||||
dataTheme.AttrBorder {
|
dataTheme.AttrBorder {
|
||||||
outline,
|
outline,
|
||||||
@ -116,14 +117,14 @@ var rules = []dataTheme.Rule {
|
|||||||
Color: borderColorEngraved,
|
Color: borderColorEngraved,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
dataTheme.AttrColor { Color: tomo.ColorSunken },
|
dataTheme.AttrColor { Color: theme.ColorSunken },
|
||||||
dataTheme.AttrPadding(tomo.I(8)),
|
dataTheme.AttrPadding(tomo.I(8)),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
// *.NumberInput[*]
|
// *.NumberInput[*]
|
||||||
dataTheme.Rule {
|
dataTheme.Rule {
|
||||||
Role: tomo.R("", "NumberInput", ""),
|
Role: theme.R("", "NumberInput", ""),
|
||||||
Default: dataTheme.AS (
|
Default: dataTheme.AS (
|
||||||
dataTheme.AttrGap { },
|
dataTheme.AttrGap { },
|
||||||
),
|
),
|
||||||
@ -131,7 +132,7 @@ var rules = []dataTheme.Rule {
|
|||||||
|
|
||||||
// *.Container[sunken]
|
// *.Container[sunken]
|
||||||
dataTheme.Rule {
|
dataTheme.Rule {
|
||||||
Role: tomo.R("", "Container", "sunken"),
|
Role: theme.R("", "Container", "sunken"),
|
||||||
Default: dataTheme.AS (
|
Default: dataTheme.AS (
|
||||||
dataTheme.AttrBorder {
|
dataTheme.AttrBorder {
|
||||||
outline,
|
outline,
|
||||||
@ -140,23 +141,23 @@ var rules = []dataTheme.Rule {
|
|||||||
Color: borderColorEngraved,
|
Color: borderColorEngraved,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
dataTheme.AttrColor { Color: tomo.ColorSunken },
|
dataTheme.AttrColor { Color: theme.ColorSunken },
|
||||||
dataTheme.AttrPadding(tomo.I(8)),
|
dataTheme.AttrPadding(tomo.I(8)),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
// *.Container[outer]
|
// *.Container[outer]
|
||||||
dataTheme.Rule {
|
dataTheme.Rule {
|
||||||
Role: tomo.R("", "Container", "outer"),
|
Role: theme.R("", "Container", "outer"),
|
||||||
Default: dataTheme.AS (
|
Default: dataTheme.AS (
|
||||||
dataTheme.AttrColor { Color: tomo.ColorBackground },
|
dataTheme.AttrColor { Color: theme.ColorBackground },
|
||||||
dataTheme.AttrPadding(tomo.I(8)),
|
dataTheme.AttrPadding(tomo.I(8)),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
// *.Heading[*]
|
// *.Heading[*]
|
||||||
dataTheme.Rule {
|
dataTheme.Rule {
|
||||||
Role: tomo.R("", "Heading", ""),
|
Role: theme.R("", "Heading", ""),
|
||||||
Default: dataTheme.AS (
|
Default: dataTheme.AS (
|
||||||
dataTheme.AttrAlign { X: tomo.AlignMiddle, Y: tomo.AlignMiddle },
|
dataTheme.AttrAlign { X: tomo.AlignMiddle, Y: tomo.AlignMiddle },
|
||||||
),
|
),
|
||||||
@ -164,7 +165,7 @@ var rules = []dataTheme.Rule {
|
|||||||
|
|
||||||
// *.Separator[*]
|
// *.Separator[*]
|
||||||
dataTheme.Rule {
|
dataTheme.Rule {
|
||||||
Role: tomo.R("", "Separator", ""),
|
Role: theme.R("", "Separator", ""),
|
||||||
Default: dataTheme.AS (
|
Default: dataTheme.AS (
|
||||||
dataTheme.AttrBorder {
|
dataTheme.AttrBorder {
|
||||||
tomo.Border {
|
tomo.Border {
|
||||||
@ -177,7 +178,7 @@ var rules = []dataTheme.Rule {
|
|||||||
|
|
||||||
// *.Slider[*]
|
// *.Slider[*]
|
||||||
dataTheme.Rule {
|
dataTheme.Rule {
|
||||||
Role: tomo.R("", "Slider", ""),
|
Role: theme.R("", "Slider", ""),
|
||||||
Default: dataTheme.AS (
|
Default: dataTheme.AS (
|
||||||
dataTheme.AttrBorder {
|
dataTheme.AttrBorder {
|
||||||
outline,
|
outline,
|
||||||
@ -203,19 +204,19 @@ var rules = []dataTheme.Rule {
|
|||||||
|
|
||||||
// *.Slider[horizontal]
|
// *.Slider[horizontal]
|
||||||
dataTheme.Rule {
|
dataTheme.Rule {
|
||||||
Role: tomo.R("", "Slider", "horizontal"),
|
Role: theme.R("", "Slider", "horizontal"),
|
||||||
Default: dataTheme.AS(dataTheme.AttrMinimumSize { X: 48 }),
|
Default: dataTheme.AS(dataTheme.AttrMinimumSize { X: 48 }),
|
||||||
},
|
},
|
||||||
|
|
||||||
// *.Slider[vertical]
|
// *.Slider[vertical]
|
||||||
dataTheme.Rule {
|
dataTheme.Rule {
|
||||||
Role: tomo.R("", "Slider", "vertical"),
|
Role: theme.R("", "Slider", "vertical"),
|
||||||
Default: dataTheme.AS(dataTheme.AttrMinimumSize { Y: 48 }),
|
Default: dataTheme.AS(dataTheme.AttrMinimumSize { Y: 48 }),
|
||||||
},
|
},
|
||||||
|
|
||||||
// *.SliderHandle[*]
|
// *.SliderHandle[*]
|
||||||
dataTheme.Rule {
|
dataTheme.Rule {
|
||||||
Role: tomo.R("", "SliderHandle", ""),
|
Role: theme.R("", "SliderHandle", ""),
|
||||||
Default: dataTheme.AS (
|
Default: dataTheme.AS (
|
||||||
dataTheme.AttrBorder {
|
dataTheme.AttrBorder {
|
||||||
outline,
|
outline,
|
||||||
@ -224,14 +225,14 @@ var rules = []dataTheme.Rule {
|
|||||||
Color: borderColorLifted,
|
Color: borderColorLifted,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
dataTheme.AttrColor { Color: tomo.ColorRaised },
|
dataTheme.AttrColor { Color: theme.ColorRaised },
|
||||||
dataTheme.AttrMinimumSize { X: 12, Y: 12, },
|
dataTheme.AttrMinimumSize { X: 12, Y: 12, },
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
// *.Checkbox[*]
|
// *.Checkbox[*]
|
||||||
dataTheme.Rule {
|
dataTheme.Rule {
|
||||||
Role: tomo.R("", "Checkbox", ""),
|
Role: theme.R("", "Checkbox", ""),
|
||||||
Default: dataTheme.AS (
|
Default: dataTheme.AS (
|
||||||
dataTheme.AttrBorder {
|
dataTheme.AttrBorder {
|
||||||
outline,
|
outline,
|
||||||
@ -240,7 +241,7 @@ var rules = []dataTheme.Rule {
|
|||||||
Color: borderColorEngraved,
|
Color: borderColorEngraved,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
dataTheme.AttrColor { Color: tomo.ColorSunken },
|
dataTheme.AttrColor { Color: theme.ColorSunken },
|
||||||
dataTheme.AttrPadding(tomo.I(0, 1, 1, 0)),
|
dataTheme.AttrPadding(tomo.I(0, 1, 1, 0)),
|
||||||
dataTheme.AttrMinimumSize { X: 19, Y: 19 },
|
dataTheme.AttrMinimumSize { X: 19, Y: 19 },
|
||||||
),
|
),
|
||||||
@ -258,7 +259,7 @@ var rules = []dataTheme.Rule {
|
|||||||
|
|
||||||
// *.LabelCheckbox[*]
|
// *.LabelCheckbox[*]
|
||||||
dataTheme.Rule {
|
dataTheme.Rule {
|
||||||
Role: tomo.R("", "LabelCheckbox", ""),
|
Role: theme.R("", "LabelCheckbox", ""),
|
||||||
Default: dataTheme.AS (
|
Default: dataTheme.AS (
|
||||||
dataTheme.AttrGap { X: 8, Y: 8 },
|
dataTheme.AttrGap { X: 8, Y: 8 },
|
||||||
),
|
),
|
||||||
|
@ -7,6 +7,7 @@ import "git.tebibyte.media/tomo/tomo"
|
|||||||
import "git.tebibyte.media/tomo/tomo/data"
|
import "git.tebibyte.media/tomo/tomo/data"
|
||||||
import "git.tebibyte.media/tomo/tomo/event"
|
import "git.tebibyte.media/tomo/tomo/event"
|
||||||
import "git.tebibyte.media/tomo/tomo/input"
|
import "git.tebibyte.media/tomo/tomo/input"
|
||||||
|
import "git.tebibyte.media/tomo/tomo/theme"
|
||||||
import "git.tebibyte.media/tomo/tomo/canvas"
|
import "git.tebibyte.media/tomo/tomo/canvas"
|
||||||
|
|
||||||
// this is CSS's bastard child
|
// this is CSS's bastard child
|
||||||
@ -21,26 +22,26 @@ type Theme struct {
|
|||||||
// Rules determines which styles get applied to which Objects.
|
// Rules determines which styles get applied to which Objects.
|
||||||
Rules []Rule
|
Rules []Rule
|
||||||
|
|
||||||
// Colors maps tomo.Color values to color.RGBA values.
|
// Colors maps theme.Color values to color.RGBA values.
|
||||||
Colors map[tomo.Color] color.Color
|
Colors map[theme.Color] color.Color
|
||||||
|
|
||||||
// This type does not handle icons, and as such, a special icon theme
|
// This type does not handle icons, and as such, a special icon theme
|
||||||
// must be separately specified.
|
// must be separately specified.
|
||||||
IconTheme
|
IconTheme
|
||||||
}
|
}
|
||||||
|
|
||||||
// IconTheme implements the part of tomo.Theme that handles icons.
|
// IconTheme implements the part of theme.Theme that handles icons.
|
||||||
type IconTheme interface {
|
type IconTheme interface {
|
||||||
// Icon returns a texture of the corresponding icon ID.
|
// Icon returns a texture of the corresponding icon ID.
|
||||||
Icon (tomo.Icon, tomo.IconSize) canvas.Texture
|
Icon (theme.Icon, theme.IconSize) canvas.Texture
|
||||||
// MimeIcon returns an icon corresponding to a MIME type.
|
// MimeIcon returns an icon corresponding to a MIME type.
|
||||||
MimeIcon (data.Mime, tomo.IconSize) canvas.Texture
|
MimeIcon (data.Mime, theme.IconSize) canvas.Texture
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rule describes under what circumstances should certain style attributes be
|
// Rule describes under what circumstances should certain style attributes be
|
||||||
// active.
|
// active.
|
||||||
type Rule struct {
|
type Rule struct {
|
||||||
Role tomo.Role
|
Role theme.Role
|
||||||
Default AttrSet
|
Default AttrSet
|
||||||
Hovered AttrSet
|
Hovered AttrSet
|
||||||
Pressed AttrSet
|
Pressed AttrSet
|
||||||
@ -104,7 +105,7 @@ func (this *Theme) execute (object tomo.Object, set AttrSet) {
|
|||||||
case AttrColor:
|
case AttrColor:
|
||||||
box.SetColor(attr.Color)
|
box.SetColor(attr.Color)
|
||||||
case AttrTexture:
|
case AttrTexture:
|
||||||
box.SetTextureTile(this.texture(string(attr)))
|
box.SetTexture(this.texture(string(attr)))
|
||||||
case AttrBorder:
|
case AttrBorder:
|
||||||
box.SetBorder([]tomo.Border(attr)...)
|
box.SetBorder([]tomo.Border(attr)...)
|
||||||
case AttrMinimumSize:
|
case AttrMinimumSize:
|
||||||
@ -132,7 +133,7 @@ func (this *Theme) execute (object tomo.Object, set AttrSet) {
|
|||||||
box.SetAlign(attr.X, attr.Y)
|
box.SetAlign(attr.X, attr.Y)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
panic("bug: nasin/internal/tomo.Theme: unexpected attribute")
|
panic("bug: nasin/internal/theme.Theme: unexpected attribute")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -164,7 +165,7 @@ func (this *Theme) ensureTextureCache () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// setsFor builds flattened attr sets for a specific role based on the rules list
|
// setsFor builds flattened attr sets for a specific role based on the rules list
|
||||||
func (this *Theme) setsFor (role tomo.Role) (defaul, hovered, pressed, focused AttrSet) {
|
func (this *Theme) setsFor (role theme.Role) (defaul, hovered, pressed, focused AttrSet) {
|
||||||
for _, current := range this.Rules {
|
for _, current := range this.Rules {
|
||||||
// check for a match
|
// check for a match
|
||||||
packageMatch := current.Role.Package == role.Package || current.Role.Package == ""
|
packageMatch := current.Role.Package == role.Package || current.Role.Package == ""
|
||||||
@ -186,7 +187,7 @@ func (this *Theme) setsFor (role tomo.Role) (defaul, hovered, pressed, focused A
|
|||||||
return defaul, hovered, pressed, focused
|
return defaul, hovered, pressed, focused
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Theme) Apply (object tomo.Object, role tomo.Role) event.Cookie {
|
func (this *Theme) Apply (object tomo.Object, role theme.Role) event.Cookie {
|
||||||
pressed := false
|
pressed := false
|
||||||
hovered := false
|
hovered := false
|
||||||
box := object.GetBox()
|
box := object.GetBox()
|
||||||
@ -231,14 +232,14 @@ func (this *Theme) Apply (object tomo.Object, role tomo.Role) event.Cookie {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Theme) RGBA (c tomo.Color) (r, g, b, a uint32) {
|
func (this *Theme) RGBA (c theme.Color) (r, g, b, a uint32) {
|
||||||
if this.Colors == nil { return 0xFFFF, 0, 0xFFFF, 0xFFFF }
|
if this.Colors == nil { return 0xFFFF, 0, 0xFFFF, 0xFFFF }
|
||||||
color, ok := this.Colors[c]
|
color, ok := this.Colors[c]
|
||||||
if !ok { return 0xFFFF, 0, 0xFFFF, 0xFFFF }
|
if !ok { return 0xFFFF, 0, 0xFFFF, 0xFFFF }
|
||||||
return color.RGBA()
|
return color.RGBA()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Theme) Icon (icon tomo.Icon, size tomo.IconSize) canvas.Texture {
|
func (this *Theme) Icon (icon theme.Icon, size theme.IconSize) canvas.Texture {
|
||||||
if this.IconTheme == nil {
|
if this.IconTheme == nil {
|
||||||
return this.missingTexture()
|
return this.missingTexture()
|
||||||
} else {
|
} else {
|
||||||
@ -246,7 +247,7 @@ func (this *Theme) Icon (icon tomo.Icon, size tomo.IconSize) canvas.Texture {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Theme) MimeIcon (mime data.Mime, size tomo.IconSize) canvas.Texture {
|
func (this *Theme) MimeIcon (mime data.Mime, size theme.IconSize) canvas.Texture {
|
||||||
if this.IconTheme == nil {
|
if this.IconTheme == nil {
|
||||||
return this.missingTexture()
|
return this.missingTexture()
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user