Compare commits

..

5 Commits

19 changed files with 751 additions and 359 deletions

View File

@ -9,7 +9,6 @@ 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"
@ -46,7 +45,7 @@ func (this *Application) Init () error {
} () } ()
window.OnClose(tomo.Stop) window.OnClose(tomo.Stop)
window.Show() window.SetVisible(true)
return nil return nil
} }
@ -69,7 +68,7 @@ func NewClockFace () *ClockFace {
box := &ClockFace { box := &ClockFace {
CanvasBox: tomo.NewCanvasBox(), CanvasBox: tomo.NewCanvasBox(),
} }
theme.Apply(box, theme.R("nasin", "ClockFace", "")) tomo.Apply(box, tomo.R("nasin", "ClockFace", ""))
box.SetDrawer(box) box.SetDrawer(box)
return box return box
} }
@ -89,7 +88,7 @@ func (this *ClockFace) Draw (destination canvas.Canvas) {
for hour := 0; hour < 12; hour ++ { for hour := 0; hour < 12; hour ++ {
radialLine ( radialLine (
destination, destination,
theme.ColorForeground, tomo.ColorForeground,
0.8, 0.9, float64(hour) / 6 * math.Pi) 0.8, 0.9, float64(hour) / 6 * math.Pi)
} }
@ -97,9 +96,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, theme.ColorForeground, 0, 0.5, (hour - 3) / 6 * math.Pi) radialLine(destination, tomo.ColorForeground, 0, 0.5, (hour - 3) / 6 * math.Pi)
radialLine(destination, theme.ColorForeground, 0, 0.7, (minute - 15) / 30 * math.Pi) radialLine(destination, tomo.ColorForeground, 0, 0.7, (minute - 15) / 30 * math.Pi)
radialLine(destination, theme.ColorAccent, 0, 0.7, (second - 15) / 30 * math.Pi) radialLine(destination, tomo.ColorAccent, 0, 0.7, (second - 15) / 30 * math.Pi)
} }
func radialLine ( func radialLine (

View File

@ -6,14 +6,13 @@ 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.Window window tomo.MainWindow
size theme.IconSize size tomo.IconSize
grid tomo.ContainerBox grid tomo.ContainerBox
} }
@ -30,23 +29,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(theme.IconSizeSmall) this.resizeIcons(tomo.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(theme.IconActionZoomOut) button.SetIcon(tomo.IconZoomOut)
button.OnClick(func () { this.resizeIcons(theme.IconSizeSmall) }) button.OnClick(func () { this.resizeIcons(tomo.IconSizeSmall) })
iconButtons.Add(button) iconButtons.Add(button)
button = objects.NewButton("medium") button = objects.NewButton("medium")
button.SetIcon(theme.IconActionZoomReset) button.SetIcon(tomo.IconZoomOriginal)
button.OnClick(func () { this.resizeIcons(theme.IconSizeMedium) }) button.OnClick(func () { this.resizeIcons(tomo.IconSizeMedium) })
iconButtons.Add(button) iconButtons.Add(button)
button = objects.NewButton("large") button = objects.NewButton("large")
button.SetIcon(theme.IconActionZoomIn) button.SetIcon(tomo.IconZoomIn)
button.OnClick(func () { this.resizeIcons(theme.IconSizeLarge) }) button.OnClick(func () { this.resizeIcons(tomo.IconSizeLarge) })
iconButtons.Add(button) iconButtons.Add(button)
container := objects.NewOuterContainer ( container := objects.NewOuterContainer (
@ -64,128 +63,311 @@ func (this *Application) Init () error {
window.SetRoot(container) window.SetRoot(container)
window.OnClose(tomo.Stop) window.OnClose(tomo.Stop)
window.Show() window.SetVisible(true)
return nil return nil
} }
func (this *Application) resizeIcons (size theme.IconSize) { func (this *Application) resizeIcons (size tomo.IconSize) {
this.size = size this.size = size
this.grid.Clear() this.grid.Clear()
icons := []theme.Icon { icons := []tomo.Icon {
theme.IconUnknown, tomo.IconUnknown,
theme.IconFile, tomo.IconAddressBookNew,
theme.IconDirectory, tomo.IconApplicationExit,
theme.IconStorage, tomo.IconAppointmentNew,
theme.IconApplication, tomo.IconCallStart,
theme.IconNetwork, tomo.IconCallStop,
theme.IconDevice, tomo.IconContactNew,
theme.IconPeripheral, tomo.IconDialogOkay,
theme.IconPort, tomo.IconDialogCancel,
theme.IconActionOpen, tomo.IconEditClear,
theme.IconActionOpenIn, tomo.IconEditCopy,
theme.IconActionSave, tomo.IconEditCut,
theme.IconActionSaveAs, tomo.IconEditDelete,
theme.IconActionPrint, tomo.IconEditFind,
theme.IconActionNew, tomo.IconEditFindReplace,
theme.IconActionNewDirectory, tomo.IconEditPaste,
theme.IconActionDelete, tomo.IconEditRedo,
theme.IconActionRename, tomo.IconEditSelectAll,
theme.IconActionGetInformation, tomo.IconEditUndo,
theme.IconActionChangePermissions, tomo.IconFileNew,
theme.IconActionRevert, tomo.IconDirectoryNew,
theme.IconActionAdd, tomo.IconFileOpen,
theme.IconActionRemove, tomo.IconFileOpenRecent,
theme.IconActionAddBookmark, tomo.IconFilePageSetup,
theme.IconActionRemoveBookmark, tomo.IconFilePrint,
theme.IconActionAddFavorite, tomo.IconFilePrintPreview,
theme.IconActionRemoveFavorite, tomo.IconFilePermissions,
theme.IconActionPlay, tomo.IconFileProperties,
theme.IconActionPause, tomo.IconFileRename,
theme.IconActionStop, tomo.IconFileRevert,
theme.IconActionFastForward, tomo.IconFileSave,
theme.IconActionRewind, tomo.IconFileSaveAs,
theme.IconActionToBeginning, tomo.IconFileSend,
theme.IconActionToEnd, tomo.IconFormatIndentLess,
theme.IconActionRecord, tomo.IconFormatIndentMore,
theme.IconActionVolumeUp, tomo.IconFormatAlignCenter,
theme.IconActionVolumeDown, tomo.IconFormatAlignEven,
theme.IconActionMute, tomo.IconFormatAlignLeft,
theme.IconActionUndo, tomo.IconFormatAlignRight,
theme.IconActionRedo, tomo.IconFormatTextDirectionLtr,
theme.IconActionCut, tomo.IconFormatTextDirectionRtl,
theme.IconActionCopy, tomo.IconFormatTextBold,
theme.IconActionPaste, tomo.IconFormatTextItalic,
theme.IconActionFind, tomo.IconFormatTextUnderline,
theme.IconActionReplace, tomo.IconFormatTextStrikethrough,
theme.IconActionSelectAll, tomo.IconGoBottom,
theme.IconActionSelectNone, tomo.IconGoDown,
theme.IconActionIncrement, tomo.IconGoFirst,
theme.IconActionDecrement, tomo.IconGoHome,
theme.IconActionClose, tomo.IconGoJump,
theme.IconActionQuit, tomo.IconGoLast,
theme.IconActionIconify, tomo.IconGoNext,
theme.IconActionShade, tomo.IconGoPrevious,
theme.IconActionMaximize, tomo.IconGoTop,
theme.IconActionFullScreen, tomo.IconGoUp,
theme.IconActionRestore, tomo.IconHelpAbout,
theme.IconActionExpand, tomo.IconHelpContents,
theme.IconActionContract, tomo.IconHelpFaq,
theme.IconActionBack, tomo.IconInsertImage,
theme.IconActionForward, tomo.IconInsertLink,
theme.IconActionUp, tomo.IconInsertObject,
theme.IconActionDown, tomo.IconInsertText,
theme.IconActionReload, tomo.IconListAdd,
theme.IconActionZoomIn, tomo.IconListRemove,
theme.IconActionZoomOut, tomo.IconMailForward,
theme.IconActionZoomReset, tomo.IconMailMarkImportant,
theme.IconActionMove, tomo.IconMailMarkJunk,
theme.IconActionResize, tomo.IconMailMarkNotJunk,
theme.IconActionGoTo, tomo.IconMailMarkRead,
theme.IconActionTransform, tomo.IconMailMarkUnread,
theme.IconActionTranslate, tomo.IconMailMessageNew,
theme.IconActionRotate, tomo.IconMailReplyAll,
theme.IconActionScale, tomo.IconMailReplySender,
theme.IconActionWarp, tomo.IconMailSend,
theme.IconActionCornerPin, tomo.IconMailReceive,
theme.IconActionSelectRectangle, tomo.IconMediaEject,
theme.IconActionSelectEllipse, tomo.IconMediaPlaybackPause,
theme.IconActionSelectLasso, tomo.IconMediaPlaybackStart,
theme.IconActionSelectGeometric, tomo.IconMediaPlaybackStop,
theme.IconActionSelectAuto, tomo.IconMediaRecord,
theme.IconActionCrop, tomo.IconMediaSeekBackward,
theme.IconActionFill, tomo.IconMediaSeekForward,
theme.IconActionGradient, tomo.IconMediaSkipBackward,
theme.IconActionPencil, tomo.IconMediaSkipForward,
theme.IconActionBrush, tomo.IconObjectFlipHorizontal,
theme.IconActionEraser, tomo.IconObjectFlipVertical,
theme.IconActionText, tomo.IconObjectRotateLeft,
theme.IconActionEyedropper, tomo.IconObjectRotateRight,
theme.IconStatusInformation, tomo.IconProcessStop,
theme.IconStatusQuestion, tomo.IconSystemLockScreen,
theme.IconStatusWarning, tomo.IconSystemLogOut,
theme.IconStatusError, tomo.IconSystemRun,
theme.IconStatusCancel, tomo.IconSystemSearch,
theme.IconStatusOkay, tomo.IconSystemReboot,
theme.IconStatusCellSignal0, tomo.IconSystemShutdown,
theme.IconStatusCellSignal1, tomo.IconToolsCheckSpelling,
theme.IconStatusCellSignal2, tomo.IconValueIncrement,
theme.IconStatusCellSignal3, tomo.IconValueDecrement,
theme.IconStatusWirelessSignal0, tomo.IconValueReset,
theme.IconStatusWirelessSignal1, tomo.IconViewFullscreen,
theme.IconStatusWirelessSignal2, tomo.IconViewRefresh,
theme.IconStatusWirelessSignal3, tomo.IconViewRestore,
theme.IconStatusBattery0, tomo.IconViewSortAscending,
theme.IconStatusBattery1, tomo.IconViewSortDescending,
theme.IconStatusBattery2, tomo.IconWindowClose,
theme.IconStatusBattery3, tomo.IconWindowNew,
theme.IconStatusBrightness0, tomo.IconZoomFitBest,
theme.IconStatusBrightness1, tomo.IconZoomIn,
theme.IconStatusBrightness2, tomo.IconZoomOriginal,
theme.IconStatusBrightness3, tomo.IconZoomOut,
theme.IconStatusVolume0, tomo.IconApplication,
theme.IconStatusVolume1, tomo.IconApplicationWebBrowser,
theme.IconStatusVolume2, tomo.IconApplicationMesssanger,
theme.IconStatusVolume3, tomo.IconApplicationPhone,
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 {
@ -199,29 +381,23 @@ func (this *Application) resizeIcons (size theme.IconSize) {
} }
} }
func (this *Application) iconPopup (icon theme.Icon) error { func (this *Application) iconPopup (icon tomo.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 }
// FIXME: remove this once https://git.tebibyte.media/tomo/tomo/issues/8 if icon == "" {
// is addressed and objects.Icon makes use of it icon = "<UNKNOWN>"
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,
valign(objects.NewIcon(icon, theme.IconSizeSmall)), objects.NewIcon(icon, tomo.IconSizeSmall),
valign(objects.NewIcon(icon, theme.IconSizeMedium)), objects.NewIcon(icon, tomo.IconSizeMedium),
valign(objects.NewIcon(icon, theme.IconSizeLarge))) objects.NewIcon(icon, tomo.IconSizeLarge))
okButton := objects.NewButton("OK") okButton := objects.NewButton("OK")
okButton.OnClick(popup.Close) okButton.OnClick(popup.Close)
okButton.SetIcon(theme.IconStatusOkay) okButton.SetIcon(tomo.IconDialogOkay)
controlRow := objects.NewInnerContainer ( controlRow := objects.NewInnerContainer (
layouts.ContractHorizontal, layouts.ContractHorizontal,
okButton) okButton)
@ -234,7 +410,7 @@ func (this *Application) iconPopup (icon theme.Icon) error {
controlRow, controlRow,
)) ))
popup.SetTitle(string(icon) + ": Properties") popup.SetTitle(string(icon) + ": Properties")
popup.Show() popup.SetVisible(true)
return nil return nil
} }

View File

@ -5,7 +5,6 @@ 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 { }
@ -29,7 +28,7 @@ func (this *Application) Init () error {
)) ))
window.OnClose(tomo.Stop) window.OnClose(tomo.Stop)
window.Show() window.SetVisible(true)
return nil return nil
} }

View File

@ -7,7 +7,6 @@ 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
@ -30,7 +29,7 @@ func (this *Application) Init () error {
checkbox.SetFocused(true) checkbox.SetFocused(true)
okButtok := objects.NewButton("OK") okButtok := objects.NewButton("OK")
okButtok.SetIcon(theme.IconStatusOkay) okButtok.SetIcon(tomo.IconDialogOkay)
okButtok.OnClick(func () { okButtok.OnClick(func () {
if checkbox.Value() { if checkbox.Value() {
window.Close() window.Close()
@ -38,7 +37,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.Show() dialog.SetVisible(true)
} }
}) })
@ -54,7 +53,7 @@ func (this *Application) Init () error {
okButtok))) okButtok)))
window.OnClose(tomo.Stop) window.OnClose(tomo.Stop)
window.Show() window.SetVisible(true)
return nil return nil
} }

6
go.mod
View File

@ -3,9 +3,9 @@ module git.tebibyte.media/tomo/nasin
go 1.20 go 1.20
require ( require (
git.tebibyte.media/tomo/objects v0.13.0 git.tebibyte.media/tomo/objects v0.15.0
git.tebibyte.media/tomo/tomo v0.31.0 git.tebibyte.media/tomo/tomo v0.34.0
git.tebibyte.media/tomo/x v0.7.6 git.tebibyte.media/tomo/x v0.9.0
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
View File

@ -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.13.0 h1:h6aC3gHEWTx4Op5M1jkmPI+GkPN9FBbQjx7zpeAhLnA= git.tebibyte.media/tomo/objects v0.15.0 h1:xCrRqOwCz8jDJk/sWw0B1HyrRCJafAuaPWN9nZj8V1U=
git.tebibyte.media/tomo/objects v0.13.0/go.mod h1:34UDkPEHxBgIsAYWyqqE4u1KvVtwzwdpCO6AdkgsrKo= git.tebibyte.media/tomo/objects v0.15.0/go.mod h1:++pM0y/xuzhgmu1RpHTWQlqrmyHLfPEF9ahyrH8Tqvk=
git.tebibyte.media/tomo/tomo v0.31.0 h1:LHPpj3AWycochnC8F441aaRNS6Tq6w6WnBrp/LGjyhM= git.tebibyte.media/tomo/tomo v0.34.0 h1:r5yJPks9rtzdDI2RyAUdqa1qb6BebG0QFe2cTmcFi+0=
git.tebibyte.media/tomo/tomo v0.31.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps= git.tebibyte.media/tomo/tomo v0.34.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.7.6 h1:2LEfVYbIuPz4ak1gCwEYxRlUq8sLBnzNDtE8m1ozIsc= git.tebibyte.media/tomo/x v0.9.0 h1:wMcbK0MOE7ea7wcU2Mgrr86ZprVGLRY2PgOG0vDJR6Y=
git.tebibyte.media/tomo/x v0.7.6/go.mod h1:8BLhXlFSTmn/y2FM+yrc6yLmMzqMhFQYYrN9SXMbmZM= git.tebibyte.media/tomo/x v0.9.0/go.mod h1:OO4PYXhzrh4ZAY12d7bg+l/P4MbkFPu6f+YVXNDRhog=
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=

View File

@ -3,11 +3,10 @@ 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 {
theme.SetTheme(defaultTheme.Theme()) tomo.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: 3.5 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

View File

@ -1,19 +1,19 @@
package defaultTheme package defaultTheme
import "image/color" import "image/color"
import "git.tebibyte.media/tomo/tomo/theme" import "git.tebibyte.media/tomo/tomo"
import dataTheme "git.tebibyte.media/tomo/nasin/internal/theme" import dataTheme "git.tebibyte.media/tomo/nasin/internal/theme"
// Theme returns Wintergreen, the default Tomo theme. It is neutral-gray with // Theme returns Wintergreen, the default Tomo tomo. It is neutral-gray with
// green and turquoise accents. // green and turquoise accents.
func Theme () theme.Theme { func Theme () tomo.Theme {
return &dataTheme.Theme { return &dataTheme.Theme {
Colors: map[theme.Color] color.Color { Colors: map[tomo.Color] color.Color {
theme.ColorBackground: colorBackground, tomo.ColorBackground: colorBackground,
theme.ColorForeground: colorForeground, tomo.ColorForeground: colorForeground,
theme.ColorRaised: colorCarved, tomo.ColorRaised: colorCarved,
theme.ColorSunken: colorCarved, tomo.ColorSunken: colorCarved,
theme.ColorAccent: colorFocus, tomo.ColorAccent: colorFocus,
}, },
Rules: rules, Rules: rules,
IconTheme: &iconTheme { }, IconTheme: &iconTheme { },

View File

@ -6,7 +6,6 @@ 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
@ -14,12 +13,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[theme.Icon] canvas.Texture { func generateSource (data []byte, width int) map[tomo.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[theme.Icon] canvas.Texture) source := make(map[tomo.Icon] canvas.Texture)
x := 0 x := 0
y := 0 y := 0
@ -27,8 +26,8 @@ func generateSource (data []byte, width int) map[theme.Icon] canvas.Texture {
x = 0 x = 0
y ++ y ++
} }
col := func (id theme.Icon) { col := func (id tomo.Icon) {
source[id] = atlasTexture.Clip(image.Rect ( source[id] = atlasTexture.SubTexture(image.Rect (
x * width, x * width,
y * width, y * width,
(x + 1) * width, (x + 1) * width,
@ -36,162 +35,385 @@ func generateSource (data []byte, width int) map[theme.Icon] canvas.Texture {
x++ x++
} }
// objects col(tomo.IconUnknown)
col(theme.IconUnknown) col(tomo.Icon("File"))
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()
col(theme.IconActionOpen) // actions
col(theme.IconActionOpenIn) col(tomo.IconAddressBookNew)
col(theme.IconActionSave) col(tomo.IconApplicationExit)
col(theme.IconActionSaveAs) col(tomo.IconAppointmentNew)
col(theme.IconActionPrint) col(tomo.IconCallStart)
col(theme.IconActionNew) col(tomo.IconCallStop)
col(theme.IconActionNewDirectory) col(tomo.IconContactNew)
col(theme.IconActionDelete) // actions: dialog
col(theme.IconActionRename) col(tomo.IconDialogOkay)
col(theme.IconActionGetInformation) col(tomo.IconDialogCancel)
col(theme.IconActionChangePermissions) // actions: edit
col(theme.IconActionRevert) col(tomo.IconEditClear)
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()
col(theme.IconActionAdd) // actions: format
col(theme.IconActionRemove) col(tomo.IconFormatIndentLess)
col(theme.IconActionAddBookmark) col(tomo.IconFormatIndentMore)
col(theme.IconActionRemoveBookmark) col(tomo.IconFormatAlignCenter)
col(theme.IconActionAddFavorite) col(tomo.IconFormatAlignEven)
col(theme.IconActionRemoveFavorite) col(tomo.IconFormatAlignLeft)
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
row() col(tomo.IconMediaEject)
col(theme.IconActionPlay) col(tomo.IconMediaPlaybackPause)
col(theme.IconActionPause) col(tomo.IconMediaPlaybackStart)
col(theme.IconActionStop) col(tomo.IconMediaPlaybackStop)
col(theme.IconActionFastForward) col(tomo.IconMediaRecord)
col(theme.IconActionRewind) col(tomo.IconMediaSeekBackward)
col(theme.IconActionToBeginning) col(tomo.IconMediaSeekForward)
col(theme.IconActionToEnd) col(tomo.IconMediaSkipBackward)
col(theme.IconActionRecord) col(tomo.IconMediaSkipForward)
col(theme.IconActionVolumeUp) // actions: object
col(theme.IconActionVolumeDown) col(tomo.IconObjectFlipHorizontal)
col(theme.IconActionMute) 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)
// actions: editing
row() row()
col(theme.IconActionUndo)
col(theme.IconActionRedo)
col(theme.IconActionCut)
col(theme.IconActionCopy)
col(theme.IconActionPaste)
col(theme.IconActionFind)
col(theme.IconActionReplace)
col(theme.IconActionSelectAll)
col(theme.IconActionSelectNone)
col(theme.IconActionIncrement)
col(theme.IconActionDecrement)
// 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 // actions: tools
row() col(tomo.IconToolsCheckSpelling)
col(theme.IconActionTransform) // actions: value
col(theme.IconActionTranslate) col(tomo.IconValueIncrement)
col(theme.IconActionRotate) col(tomo.IconValueDecrement)
col(theme.IconActionScale) col(tomo.IconValueReset)
col(theme.IconActionWarp) // actions: view
col(theme.IconActionCornerPin) col(tomo.IconViewFullscreen)
col(theme.IconActionSelectRectangle) col(tomo.IconViewRefresh)
col(theme.IconActionSelectEllipse) col(tomo.IconViewRestore)
col(theme.IconActionSelectLasso) col(tomo.IconViewSortAscending)
col(theme.IconActionSelectGeometric) col(tomo.IconViewSortDescending)
col(theme.IconActionSelectAuto) // actions: window
col(theme.IconActionCrop) col(tomo.IconWindowClose)
col(theme.IconActionFill) col(tomo.IconWindowNew)
row() // actions: zoom
col(theme.IconActionGradient) col(tomo.IconZoomFitBest)
col(theme.IconActionPencil) col(tomo.IconZoomIn)
col(theme.IconActionBrush) col(tomo.IconZoomOriginal)
col(theme.IconActionEraser) col(tomo.IconZoomOut)
col(theme.IconActionText)
col(theme.IconActionEyedropper)
// status: dialog
row() row()
col(theme.IconStatusInformation) // applications
col(theme.IconStatusQuestion) // Keep these in sync with nasin.ApplicationRole!
col(theme.IconStatusWarning) col(tomo.IconApplication)
col(theme.IconStatusError) col(tomo.IconApplicationWebBrowser)
col(theme.IconStatusCancel) col(tomo.IconApplicationMesssanger)
col(theme.IconStatusOkay) col(tomo.IconApplicationPhone)
col(tomo.IconApplicationMail)
col(tomo.IconApplicationTerminalEmulator)
col(tomo.IconApplicationFileBrowser)
col(tomo.IconApplicationTextEditor)
col(tomo.IconApplicationDocumentViewer)
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 // status: network
row() col(tomo.IconCellularSignal0)
col(theme.IconStatusCellSignal0) col(tomo.IconCellularSignal1)
col(theme.IconStatusCellSignal1) col(tomo.IconCellularSignal2)
col(theme.IconStatusCellSignal2) col(tomo.IconCellularSignal3)
col(theme.IconStatusCellSignal3) col(tomo.IconWirelessSignal0)
col(theme.IconStatusWirelessSignal0) col(tomo.IconWirelessSignal1)
col(theme.IconStatusWirelessSignal1) col(tomo.IconWirelessSignal2)
col(theme.IconStatusWirelessSignal2) col(tomo.IconWirelessSignal3)
col(theme.IconStatusWirelessSignal3) 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 // status: power
row() col(tomo.IconBattery0)
col(theme.IconStatusBattery0) col(tomo.IconBattery1)
col(theme.IconStatusBattery1) col(tomo.IconBattery2)
col(theme.IconStatusBattery2) col(tomo.IconBattery3)
col(theme.IconStatusBattery3) col(tomo.IconBrightness0)
col(theme.IconStatusBrightness0) col(tomo.IconBrightness1)
col(theme.IconStatusBrightness1) col(tomo.IconBrightness2)
col(theme.IconStatusBrightness2) col(tomo.IconBrightness3)
col(theme.IconStatusBrightness3)
// status: media // status: media
row() col(tomo.IconVolume0)
col(theme.IconStatusVolume0) col(tomo.IconVolume1)
col(theme.IconStatusVolume1) col(tomo.IconVolume2)
col(theme.IconStatusVolume2) col(tomo.IconVolume3)
col(theme.IconStatusVolume3) 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)
return source return source
} }
type iconTheme struct { type iconTheme struct {
texturesSmall map[theme.Icon] canvas.Texture texturesSmall map[tomo.Icon] canvas.Texture
texturesLarge map[theme.Icon] canvas.Texture texturesLarge map[tomo.Icon] canvas.Texture
} }
func (this *iconTheme) ensure () { func (this *iconTheme) ensure () {
@ -200,29 +422,29 @@ func (this *iconTheme) ensure () {
this.texturesLarge = generateSource(atlasLargeBytes, 32) this.texturesLarge = generateSource(atlasLargeBytes, 32)
} }
func (this *iconTheme) selectSource (size theme.IconSize) map[theme.Icon] canvas.Texture { func (this *iconTheme) selectSource (size tomo.IconSize) map[tomo.Icon] canvas.Texture {
if size == theme.IconSizeSmall { if size == tomo.IconSizeSmall {
return this.texturesSmall return this.texturesSmall
} else { } else {
return this.texturesLarge return this.texturesLarge
} }
} }
func (this *iconTheme) Icon (icon theme.Icon, size theme.IconSize) canvas.Texture { func (this *iconTheme) Icon (icon tomo.Icon, size tomo.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[theme.IconUnknown] return source[tomo.IconUnknown]
} }
func (this *iconTheme) MimeIcon (mime data.Mime, size theme.IconSize) canvas.Texture { func (this *iconTheme) MimeIcon (mime data.Mime, size tomo.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[theme.IconDirectory] return source[tomo.IconPlaceDirectory]
} else { } else {
return source[theme.IconFile] return source[tomo.Icon("File")]
} }
} }

View File

@ -3,7 +3,6 @@ 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 }
@ -38,15 +37,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: theme.ColorForeground }, dataTheme.AttrTextColor { Color: tomo.ColorForeground },
dataTheme.AttrDotColor { Color: theme.ColorAccent }, dataTheme.AttrDotColor { Color: tomo.ColorAccent },
dataTheme.AttrGap { X: 8, Y: 8 }, dataTheme.AttrGap { X: 8, Y: 8 },
), ),
}, },
// *.Button[*] // *.Button[*]
dataTheme.Rule { dataTheme.Rule {
Role: theme.R("", "Button", ""), Role: tomo.R("", "Button", ""),
Default: dataTheme.AS ( Default: dataTheme.AS (
dataTheme.AttrBorder { dataTheme.AttrBorder {
outline, outline,
@ -56,7 +55,7 @@ var rules = []dataTheme.Rule {
}, },
}, },
dataTheme.AttrPadding(tomo.I(4, 8)), dataTheme.AttrPadding(tomo.I(4, 8)),
dataTheme.AttrColor { Color: theme.ColorRaised }, dataTheme.AttrColor { Color: tomo.ColorRaised },
), ),
Pressed: dataTheme.AS ( Pressed: dataTheme.AS (
dataTheme.AttrBorder { dataTheme.AttrBorder {
@ -83,7 +82,7 @@ var rules = []dataTheme.Rule {
// *.TextInput[*] // *.TextInput[*]
dataTheme.Rule { dataTheme.Rule {
Role: theme.R("", "TextInput", ""), Role: tomo.R("", "TextInput", ""),
Default: dataTheme.AS ( Default: dataTheme.AS (
dataTheme.AttrBorder { dataTheme.AttrBorder {
outline, outline,
@ -108,7 +107,7 @@ var rules = []dataTheme.Rule {
// *.TextView[*] // *.TextView[*]
dataTheme.Rule { dataTheme.Rule {
Role: theme.R("", "TextView", ""), Role: tomo.R("", "TextView", ""),
Default: dataTheme.AS ( Default: dataTheme.AS (
dataTheme.AttrBorder { dataTheme.AttrBorder {
outline, outline,
@ -117,14 +116,14 @@ var rules = []dataTheme.Rule {
Color: borderColorEngraved, Color: borderColorEngraved,
}, },
}, },
dataTheme.AttrColor { Color: theme.ColorSunken }, dataTheme.AttrColor { Color: tomo.ColorSunken },
dataTheme.AttrPadding(tomo.I(8)), dataTheme.AttrPadding(tomo.I(8)),
), ),
}, },
// *.NumberInput[*] // *.NumberInput[*]
dataTheme.Rule { dataTheme.Rule {
Role: theme.R("", "NumberInput", ""), Role: tomo.R("", "NumberInput", ""),
Default: dataTheme.AS ( Default: dataTheme.AS (
dataTheme.AttrGap { }, dataTheme.AttrGap { },
), ),
@ -132,7 +131,7 @@ var rules = []dataTheme.Rule {
// *.Container[sunken] // *.Container[sunken]
dataTheme.Rule { dataTheme.Rule {
Role: theme.R("", "Container", "sunken"), Role: tomo.R("", "Container", "sunken"),
Default: dataTheme.AS ( Default: dataTheme.AS (
dataTheme.AttrBorder { dataTheme.AttrBorder {
outline, outline,
@ -141,23 +140,23 @@ var rules = []dataTheme.Rule {
Color: borderColorEngraved, Color: borderColorEngraved,
}, },
}, },
dataTheme.AttrColor { Color: theme.ColorSunken }, dataTheme.AttrColor { Color: tomo.ColorSunken },
dataTheme.AttrPadding(tomo.I(8)), dataTheme.AttrPadding(tomo.I(8)),
), ),
}, },
// *.Container[outer] // *.Container[outer]
dataTheme.Rule { dataTheme.Rule {
Role: theme.R("", "Container", "outer"), Role: tomo.R("", "Container", "outer"),
Default: dataTheme.AS ( Default: dataTheme.AS (
dataTheme.AttrColor { Color: theme.ColorBackground }, dataTheme.AttrColor { Color: tomo.ColorBackground },
dataTheme.AttrPadding(tomo.I(8)), dataTheme.AttrPadding(tomo.I(8)),
), ),
}, },
// *.Heading[*] // *.Heading[*]
dataTheme.Rule { dataTheme.Rule {
Role: theme.R("", "Heading", ""), Role: tomo.R("", "Heading", ""),
Default: dataTheme.AS ( Default: dataTheme.AS (
dataTheme.AttrAlign { X: tomo.AlignMiddle, Y: tomo.AlignMiddle }, dataTheme.AttrAlign { X: tomo.AlignMiddle, Y: tomo.AlignMiddle },
), ),
@ -165,7 +164,7 @@ var rules = []dataTheme.Rule {
// *.Separator[*] // *.Separator[*]
dataTheme.Rule { dataTheme.Rule {
Role: theme.R("", "Separator", ""), Role: tomo.R("", "Separator", ""),
Default: dataTheme.AS ( Default: dataTheme.AS (
dataTheme.AttrBorder { dataTheme.AttrBorder {
tomo.Border { tomo.Border {
@ -178,7 +177,7 @@ var rules = []dataTheme.Rule {
// *.Slider[*] // *.Slider[*]
dataTheme.Rule { dataTheme.Rule {
Role: theme.R("", "Slider", ""), Role: tomo.R("", "Slider", ""),
Default: dataTheme.AS ( Default: dataTheme.AS (
dataTheme.AttrBorder { dataTheme.AttrBorder {
outline, outline,
@ -204,19 +203,19 @@ var rules = []dataTheme.Rule {
// *.Slider[horizontal] // *.Slider[horizontal]
dataTheme.Rule { dataTheme.Rule {
Role: theme.R("", "Slider", "horizontal"), Role: tomo.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: theme.R("", "Slider", "vertical"), Role: tomo.R("", "Slider", "vertical"),
Default: dataTheme.AS(dataTheme.AttrMinimumSize { Y: 48 }), Default: dataTheme.AS(dataTheme.AttrMinimumSize { Y: 48 }),
}, },
// *.SliderHandle[*] // *.SliderHandle[*]
dataTheme.Rule { dataTheme.Rule {
Role: theme.R("", "SliderHandle", ""), Role: tomo.R("", "SliderHandle", ""),
Default: dataTheme.AS ( Default: dataTheme.AS (
dataTheme.AttrBorder { dataTheme.AttrBorder {
outline, outline,
@ -225,14 +224,14 @@ var rules = []dataTheme.Rule {
Color: borderColorLifted, Color: borderColorLifted,
}, },
}, },
dataTheme.AttrColor { Color: theme.ColorRaised }, dataTheme.AttrColor { Color: tomo.ColorRaised },
dataTheme.AttrMinimumSize { X: 12, Y: 12, }, dataTheme.AttrMinimumSize { X: 12, Y: 12, },
), ),
}, },
// *.Checkbox[*] // *.Checkbox[*]
dataTheme.Rule { dataTheme.Rule {
Role: theme.R("", "Checkbox", ""), Role: tomo.R("", "Checkbox", ""),
Default: dataTheme.AS ( Default: dataTheme.AS (
dataTheme.AttrBorder { dataTheme.AttrBorder {
outline, outline,
@ -241,7 +240,7 @@ var rules = []dataTheme.Rule {
Color: borderColorEngraved, Color: borderColorEngraved,
}, },
}, },
dataTheme.AttrColor { Color: theme.ColorSunken }, dataTheme.AttrColor { Color: tomo.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 },
), ),
@ -259,7 +258,7 @@ var rules = []dataTheme.Rule {
// *.LabelCheckbox[*] // *.LabelCheckbox[*]
dataTheme.Rule { dataTheme.Rule {
Role: theme.R("", "LabelCheckbox", ""), Role: tomo.R("", "LabelCheckbox", ""),
Default: dataTheme.AS ( Default: dataTheme.AS (
dataTheme.AttrGap { X: 8, Y: 8 }, dataTheme.AttrGap { X: 8, Y: 8 },
), ),

View File

@ -7,7 +7,6 @@ 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
@ -22,26 +21,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 theme.Color values to color.RGBA values. // Colors maps tomo.Color values to color.RGBA values.
Colors map[theme.Color] color.Color Colors map[tomo.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 theme.Theme that handles icons. // IconTheme implements the part of tomo.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 (theme.Icon, theme.IconSize) canvas.Texture Icon (tomo.Icon, tomo.IconSize) canvas.Texture
// MimeIcon returns an icon corresponding to a MIME type. // MimeIcon returns an icon corresponding to a MIME type.
MimeIcon (data.Mime, theme.IconSize) canvas.Texture MimeIcon (data.Mime, tomo.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 theme.Role Role tomo.Role
Default AttrSet Default AttrSet
Hovered AttrSet Hovered AttrSet
Pressed AttrSet Pressed AttrSet
@ -105,7 +104,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.SetTexture(this.texture(string(attr))) box.SetTextureTile(this.texture(string(attr)))
case AttrBorder: case AttrBorder:
box.SetBorder([]tomo.Border(attr)...) box.SetBorder([]tomo.Border(attr)...)
case AttrMinimumSize: case AttrMinimumSize:
@ -133,7 +132,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/theme.Theme: unexpected attribute") panic("bug: nasin/internal/tomo.Theme: unexpected attribute")
} }
} }
} }
@ -165,7 +164,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 theme.Role) (defaul, hovered, pressed, focused AttrSet) { func (this *Theme) setsFor (role tomo.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 == ""
@ -187,7 +186,7 @@ func (this *Theme) setsFor (role theme.Role) (defaul, hovered, pressed, focused
return defaul, hovered, pressed, focused return defaul, hovered, pressed, focused
} }
func (this *Theme) Apply (object tomo.Object, role theme.Role) event.Cookie { func (this *Theme) Apply (object tomo.Object, role tomo.Role) event.Cookie {
pressed := false pressed := false
hovered := false hovered := false
box := object.GetBox() box := object.GetBox()
@ -232,14 +231,14 @@ func (this *Theme) Apply (object tomo.Object, role theme.Role) event.Cookie {
} }
func (this *Theme) RGBA (c theme.Color) (r, g, b, a uint32) { func (this *Theme) RGBA (c tomo.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 theme.Icon, size theme.IconSize) canvas.Texture { func (this *Theme) Icon (icon tomo.Icon, size tomo.IconSize) canvas.Texture {
if this.IconTheme == nil { if this.IconTheme == nil {
return this.missingTexture() return this.missingTexture()
} else { } else {
@ -247,7 +246,7 @@ func (this *Theme) Icon (icon theme.Icon, size theme.IconSize) canvas.Texture {
} }
} }
func (this *Theme) MimeIcon (mime data.Mime, size theme.IconSize) canvas.Texture { func (this *Theme) MimeIcon (mime data.Mime, size tomo.IconSize) canvas.Texture {
if this.IconTheme == nil { if this.IconTheme == nil {
return this.missingTexture() return this.missingTexture()
} else { } else {