main: restructure nav menu into alphabetical per-DB options

This commit is contained in:
mappu 2024-06-23 16:20:06 +12:00
parent bc33d26cfd
commit 43002a9fde

74
main.go
View File

@ -46,36 +46,64 @@ func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
mnuFile := vcl.NewMenuItem(f) mnuFile := vcl.NewMenuItem(f)
mnuFile.SetCaption("File") mnuFile.SetCaption("File")
mnuFileOpen := vcl.NewMenuItem(mnuFile) mnuFileBadger := vcl.NewMenuItem(mnuFile)
mnuFileOpen.SetCaption("Open Bolt database...") mnuFileBadger.SetCaption("Badger")
mnuFileOpen.SetImageIndex(imgDatabaseAdd) mnuFileBadger.SetImageIndex(imgVendorGithub)
mnuFileOpen.SetShortCutFromString("Ctrl+O") mnuFile.Add(mnuFileBadger)
mnuFileOpen.SetOnClick(f.OnMnuFileOpenClick)
mnuFile.Add(mnuFileOpen)
mnuFileSqliteOpen := vcl.NewMenuItem(mnuFile) mnuFileBadgerOpen := vcl.NewMenuItem(mnuFileBadger)
mnuFileSqliteOpen.SetCaption("Open SQLite database...") mnuFileBadgerOpen.SetCaption("Open database...")
mnuFileSqliteOpen.SetImageIndex(imgDatabaseAdd)
mnuFileSqliteOpen.SetOnClick(f.OnMnuFileSqliteOpenClick)
mnuFile.Add(mnuFileSqliteOpen)
mnuFileBadgerOpen := vcl.NewMenuItem(mnuFile)
mnuFileBadgerOpen.SetCaption("Open Badger v4 database...")
mnuFileBadgerOpen.SetImageIndex(imgDatabaseAdd) mnuFileBadgerOpen.SetImageIndex(imgDatabaseAdd)
mnuFileBadgerOpen.SetOnClick(f.OnMnuFileBadgerOpenClick) mnuFileBadgerOpen.SetOnClick(f.OnMnuFileBadgerOpenClick)
mnuFile.Add(mnuFileBadgerOpen) mnuFileBadger.Add(mnuFileBadgerOpen)
mnuFileSqliteMemory := vcl.NewMenuItem(mnuFile) //
mnuFileSqliteMemory.SetCaption("New SQLite in-memory database")
mnuFileSqliteMemory.SetImageIndex(imgDatabaseAdd)
mnuFileSqliteMemory.SetOnClick(f.OnMnuFileSqliteMemoryClick)
mnuFile.Add(mnuFileSqliteMemory)
mnuFileRedisConnect := vcl.NewMenuItem(mnuFile) mnuFileBolt := vcl.NewMenuItem(mnuFile)
mnuFileRedisConnect.SetCaption("Connect to Redis...") mnuFileBolt.SetCaption("Bolt")
mnuFileBolt.SetImageIndex(imgVendorGithub)
mnuFile.Add(mnuFileBolt)
mnuFileBoltOpen := vcl.NewMenuItem(mnuFileBolt)
mnuFileBoltOpen.SetCaption("Open database...")
mnuFileBoltOpen.SetImageIndex(imgDatabaseAdd)
mnuFileBoltOpen.SetShortCutFromString("Ctrl+O")
mnuFileBoltOpen.SetOnClick(f.OnMnuFileOpenClick)
mnuFileBolt.Add(mnuFileBoltOpen)
//
mnuFileRedis := vcl.NewMenuItem(mnuFile)
mnuFileRedis.SetCaption("Redis")
mnuFileRedis.SetImageIndex(imgVendorRedis)
mnuFile.Add(mnuFileRedis)
mnuFileRedisConnect := vcl.NewMenuItem(mnuFileRedis)
mnuFileRedisConnect.SetCaption("Connect...")
mnuFileRedisConnect.SetImageIndex(imgDatabaseAdd) mnuFileRedisConnect.SetImageIndex(imgDatabaseAdd)
mnuFileRedisConnect.SetOnClick(f.OnMnuFileRedisConnectClick) mnuFileRedisConnect.SetOnClick(f.OnMnuFileRedisConnectClick)
mnuFile.Add(mnuFileRedisConnect) mnuFileRedis.Add(mnuFileRedisConnect)
//
mnuFileSqlite := vcl.NewMenuItem(mnuFile)
mnuFileSqlite.SetCaption("SQLite")
mnuFileSqlite.SetImageIndex(imgVendorSqlite)
mnuFile.Add(mnuFileSqlite)
mnuFileSqliteOpen := vcl.NewMenuItem(mnuFileSqlite)
mnuFileSqliteOpen.SetCaption("Open database...")
mnuFileSqliteOpen.SetImageIndex(imgDatabaseAdd)
mnuFileSqliteOpen.SetOnClick(f.OnMnuFileSqliteOpenClick)
mnuFileSqlite.Add(mnuFileSqliteOpen)
mnuFileSqliteMemory := vcl.NewMenuItem(mnuFileSqlite)
mnuFileSqliteMemory.SetCaption("New in-memory database")
mnuFileSqliteMemory.SetImageIndex(imgDatabaseAdd)
mnuFileSqliteMemory.SetOnClick(f.OnMnuFileSqliteMemoryClick)
mnuFileSqlite.Add(mnuFileSqliteMemory)
//
mnuSep := vcl.NewMenuItem(mnuFile) mnuSep := vcl.NewMenuItem(mnuFile)
mnuSep.SetCaption("-") // Creates separator mnuSep.SetCaption("-") // Creates separator