add Ctrl+G shortcut
This commit is contained in:
@@ -71,6 +71,10 @@ func (m *Controller) QueueShowModalFunc(f func()) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Controller) HaveModal() bool {
|
||||||
|
return m.haveModal
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Controller) ShowPopUpImage(img image.Image) {
|
func (m *Controller) ShowPopUpImage(img image.Image) {
|
||||||
im := canvas.NewImageFromImage(img)
|
im := canvas.NewImageFromImage(img)
|
||||||
im.FillMode = canvas.ImageFillContain
|
im.FillMode = canvas.ImageFillContain
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import (
|
|||||||
var (
|
var (
|
||||||
ShortcutReload = desktop.CustomShortcut{KeyName: fyne.KeyR, Modifier: os.ControlModifier}
|
ShortcutReload = desktop.CustomShortcut{KeyName: fyne.KeyR, Modifier: os.ControlModifier}
|
||||||
ShortcutSearch = desktop.CustomShortcut{KeyName: fyne.KeyF, Modifier: os.ControlModifier}
|
ShortcutSearch = desktop.CustomShortcut{KeyName: fyne.KeyF, Modifier: os.ControlModifier}
|
||||||
|
ShortcutQuickSearch = desktop.CustomShortcut{KeyName: fyne.KeyG, Modifier: os.ControlModifier}
|
||||||
ShortcutCloseWindow = desktop.CustomShortcut{KeyName: fyne.KeyW, Modifier: os.ControlModifier}
|
ShortcutCloseWindow = desktop.CustomShortcut{KeyName: fyne.KeyW, Modifier: os.ControlModifier}
|
||||||
|
|
||||||
ShortcutNavOne = desktop.CustomShortcut{KeyName: fyne.Key1, Modifier: os.ControlModifier}
|
ShortcutNavOne = desktop.CustomShortcut{KeyName: fyne.Key1, Modifier: os.ControlModifier}
|
||||||
@@ -249,10 +250,19 @@ func (m *MainWindow) addShortcuts() {
|
|||||||
m.BrowsingPane.Reload()
|
m.BrowsingPane.Reload()
|
||||||
})
|
})
|
||||||
m.Canvas().AddShortcut(&ShortcutSearch, func(_ fyne.Shortcut) {
|
m.Canvas().AddShortcut(&ShortcutSearch, func(_ fyne.Shortcut) {
|
||||||
|
if m.Controller.HaveModal() {
|
||||||
|
// Do not focus search widget behind modal dialog
|
||||||
|
return
|
||||||
|
}
|
||||||
if s := m.BrowsingPane.GetSearchBarIfAny(); s != nil {
|
if s := m.BrowsingPane.GetSearchBarIfAny(); s != nil {
|
||||||
m.Window.Canvas().Focus(s)
|
m.Window.Canvas().Focus(s)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
m.Canvas().AddShortcut(&ShortcutQuickSearch, func(_ fyne.Shortcut) {
|
||||||
|
if !m.Controller.HaveModal() {
|
||||||
|
m.Controller.ShowQuickSearch()
|
||||||
|
}
|
||||||
|
})
|
||||||
m.Canvas().AddShortcut(&fyne.ShortcutSelectAll{}, func(_ fyne.Shortcut) {
|
m.Canvas().AddShortcut(&fyne.ShortcutSelectAll{}, func(_ fyne.Shortcut) {
|
||||||
m.BrowsingPane.SelectAll()
|
m.BrowsingPane.SelectAll()
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user