removed lint errors

menu entries for windows can have diferent labels to the window title.
(this was already a feature but it is now more clear/onvenient. change
prompted by lint error).
This commit is contained in:
JetSetIlly 2021-01-11 11:33:33 +00:00
parent 364fef5228
commit 49a8de6c31
43 changed files with 168 additions and 46 deletions

View file

@ -66,7 +66,7 @@ func (dbg *Debugger) CatchUpLoop(continueCheck func() bool) error {
func (dbg *Debugger) PushRewind(fn int, last bool) bool {
// try pushing to the rewinding channel.
//
// if we cannot then that means a rewind is currenly taking place and we
// if we cannot then that means a rewind is currently taking place and we
// return false to indicate that the request rewind has not taken place yet.
select {
case dbg.rewinding <- true:
@ -132,7 +132,7 @@ func (dbg *Debugger) PushRewind(fn int, last bool) bool {
func (dbg *Debugger) PushGotoCoords(scanline int, horizpos int) {
// try pushing to rewinding channel. do not continue if we cannot.
//
// unlike PushRewind() no indicator of sucess is returned. the request is
// unlike PushRewind() no indicator of success is returned. the request is
// just dropped.
select {
case dbg.rewinding <- true:

View file

@ -61,7 +61,7 @@ const (
ReqVSync FeatureReq = "ReqVSync" // bool
// put gui output into full-screen mode (ie. no window border and content
// the size of the monitor)
// the size of the monitor).
ReqFullScreen FeatureReq = "ReqFullScreen" // bool
// the add VCS request is used to associate the gui with an emulated VCS.

View file

@ -52,7 +52,7 @@ type imguiColors struct {
CPUStatusOn imgui.Vec4
CPUStatusOff imgui.Vec4
// color showing that a value is different to the correpsonding value at
// color showing that a value is different to the corresponding value at
// the comparison point
ValueDiff imgui.Vec4

View file

@ -155,7 +155,7 @@ func imguiLabel(text string) {
imgui.SameLine()
}
// position cursor for indented imgui.Text()
// position cursor for indented imgui.Text().
func imguiIndentText(text string) {
p := imgui.CursorPos()
p.X += 10
@ -262,7 +262,7 @@ func (img *SdlImgui) imguiWindowQuadrant(p imgui.Vec2) imgui.Vec2 {
return q
}
// packedPalette is an array of imgui.PackedColor
// packedPalette is an array of imgui.PackedColor.
type packedPalette []imgui.PackedColor
// use appropriate palette for television spec.

View file

@ -25,6 +25,7 @@ import (
type window interface {
init()
id() string
menuLabel() string
destroy()
draw()
isOpen() bool
@ -71,14 +72,14 @@ type manager struct {
}
// windowDef specifies a window creator, the menu it appears in whether it
// should open on start
// should open on start.
type windowDef struct {
create func(*SdlImgui) (window, error)
menu string
open bool
}
// list of windows to add to the window manager
// list of windows to add to the window manager.
var windowDefs = [...]windowDef{
// windows called from "debugger" menu
{create: newFileSelector, menu: menuDebugger},
@ -120,7 +121,7 @@ var windowDefs = [...]windowDef{
{create: newWinSaveKeyEEPROM, menu: menuSaveKey},
}
// list of windows that can be opened in playmode in addition to the debugger
// list of windows that can be opened in playmode in addition to the debugger.
var playmodeWindows = [...]string{
winCRTPrefsTitle,
}

View file

@ -38,9 +38,10 @@ func (wm *manager) drawMenu() {
// see commentary for screenPos in windowManager declaration
wm.screenPos = imgui.WindowPos()
// debugger menu
if imgui.BeginMenu(menuDebugger) {
for _, id := range wm.menu[menuDebugger] {
drawMenuEntry(wm.windows[id], id)
drawMenuEntry(wm.windows[id])
}
imguiSeparator()
@ -51,28 +52,28 @@ func (wm *manager) drawMenu() {
imgui.EndMenu()
}
// window menu
// vcs menu
if imgui.BeginMenu(menuVCS) {
for _, id := range wm.menu[menuVCS] {
drawMenuEntry(wm.windows[id], id)
drawMenuEntry(wm.windows[id])
}
imgui.EndMenu()
}
// add cartridge menu
// cartridge menu requires some additional work
if _, ok := wm.menu[wm.img.lz.Cart.ID]; ok || wm.img.lz.Cart.HasRAMbus || wm.img.lz.Cart.HasStaticBus {
if imgui.BeginMenu(fmt.Sprintf("Cart [%s]", wm.img.lz.Cart.ID)) {
for _, id := range wm.menu[wm.img.lz.Cart.ID] {
drawMenuEntry(wm.windows[id], id)
drawMenuEntry(wm.windows[id])
}
if wm.img.lz.Cart.HasRAMbus {
drawMenuEntry(wm.windows[winCartRAMTitle], winCartRAMTitle)
drawMenuEntry(wm.windows[winCartRAMTitle])
}
if wm.img.lz.Cart.HasStaticBus {
drawMenuEntry(wm.windows[winCartStaticTitle], winCartStaticTitle)
drawMenuEntry(wm.windows[winCartStaticTitle])
}
imgui.EndMenu()
@ -83,7 +84,7 @@ func (wm *manager) drawMenu() {
if wm.img.lz.Cart.IsPlusROM {
if imgui.BeginMenu(menuPlusROM) {
for _, id := range wm.menu[menuPlusROM] {
drawMenuEntry(wm.windows[id], id)
drawMenuEntry(wm.windows[id])
}
imgui.EndMenu()
}
@ -93,7 +94,7 @@ func (wm *manager) drawMenu() {
if wm.img.lz.SaveKey.SaveKeyActive {
if imgui.BeginMenu(menuSaveKey) {
for _, id := range wm.menu[menuSaveKey] {
drawMenuEntry(wm.windows[id], id)
drawMenuEntry(wm.windows[id])
}
imgui.EndMenu()
}
@ -106,17 +107,19 @@ func (wm *manager) drawMenu() {
imgui.EndMainMenuBar()
}
func drawMenuEntry(w window, id string) {
func drawMenuEntry(w window) {
label := w.menuLabel()
// decorate the menu entry with an "window open" indicator
if w.isOpen() {
// checkmark is unicode middle dot - code 00b7
id = fmt.Sprintf("· %s", id)
label = fmt.Sprintf("· %s", label)
} else {
id = fmt.Sprintf(" %s", id)
label = fmt.Sprintf(" %s", label)
}
// window menu entries are toggleable
if imgui.Selectable(id) {
if imgui.Selectable(label) {
if w.isOpen() {
w.setOpen(false)
} else {

View file

@ -31,7 +31,7 @@ const (
idleSleepPeriod = 500
)
// time periods used to slow down / speed up event handling (in milliseconds)
// time periods used to slow down / speed up event handling (in milliseconds).
const (
frictionPeriod = 50
wakefullnessPeriod = 3000 // 3 seconds

View file

@ -29,7 +29,7 @@ type preferences struct {
img *SdlImgui
// two disk objects so we can load and save the preferences assigned to
// them seperately. both use the same prefs file
// them separately. both use the same prefs file.
dsk *prefs.Disk
dskWin *prefs.Disk
@ -174,9 +174,9 @@ func (p *preferences) save() error {
}
// loadWin preferences from disk.
func (p *preferences) loadWin() error {
return p.dskWin.Load(false)
}
// func (p *preferences) loadWin() error {
// return p.dskWin.Load(false)
// }
// saveWin preferences to disk.
func (p *preferences) saveWin() error {

View file

@ -421,6 +421,13 @@ func (scr *screen) render() {
if scr.crit.renderIdx == scr.crit.plotIdx {
scr.crit.renderIdx = v
scr.crit.section.Unlock()
// old versions of this code returns from the render() function at
// this point, skipped the scr.renderers loop below. this was okay
// but it caused problems with the phosphor texture, particularly
// when the CRT prefs window was open. precise reason for this is
// unknown but completing the render function normally fixes the
// problem.
} else {
scr.copyPixels()
scr.crit.section.Unlock()
@ -445,7 +452,7 @@ func (scr *screen) render() {
}
}
// copy pixels from buffer to the pixels and update phosphor pixels
// copy pixels from buffer to the pixels and update phosphor pixels.
func (scr *screen) copyPixels() {
// copy pixels from render buffer to the live copy.
for i := 0; i < len(scr.crit.bufferPixels[scr.crit.renderIdx].Pix); i += 4 {

View file

@ -51,6 +51,10 @@ func (win *winAudio) id() string {
return winAudioTitle
}
func (win *winAudio) menuLabel() string {
return winAudioTitle
}
func (win *winAudio) isOpen() bool {
return win.open
}

View file

@ -47,6 +47,10 @@ func (win *winCDFRegisters) id() string {
return winCDFRegistersTitle
}
func (win *winCDFRegisters) menuLabel() string {
return winCDFRegistersTitle
}
func (win *winCDFRegisters) isOpen() bool {
return win.open
}

View file

@ -47,6 +47,10 @@ func (win *winDPCregisters) id() string {
return winDPCregistersTitle
}
func (win *winDPCregisters) menuLabel() string {
return winDPCregistersTitle
}
func (win *winDPCregisters) isOpen() bool {
return win.open
}

View file

@ -47,6 +47,10 @@ func (win *winDPCplusRegisters) id() string {
return winDPCplusRegistersTitle
}
func (win *winDPCplusRegisters) menuLabel() string {
return winDPCplusRegistersTitle
}
func (win *winDPCplusRegisters) isOpen() bool {
return win.open
}

View file

@ -50,6 +50,10 @@ func (win *winCartRAM) id() string {
return winCartRAMTitle
}
func (win *winCartRAM) menuLabel() string {
return winCartRAMTitle
}
func (win *winCartRAM) isOpen() bool {
return win.open
}
@ -86,11 +90,12 @@ func (win *winCartRAM) draw() {
origin = (origin & memorymap.CartridgeBits) | memorymap.OriginCartFxxxMirror
}
bnk := bank
drawByteGrid(a.Data, b.Data, win.img.cols.ValueDiff, origin,
func(addr uint16, data uint8) {
win.img.lz.Dbg.PushRawEvent(func() {
idx := int(addr - origin)
win.img.lz.Dbg.VCS.Mem.Cart.GetRAMbus().PutRAM(bank, idx, data)
win.img.lz.Dbg.VCS.Mem.Cart.GetRAMbus().PutRAM(bnk, idx, data)
})
})

View file

@ -24,10 +24,6 @@ const winCartStaticTitle = "Static Areas"
type winCartStatic struct {
img *SdlImgui
open bool
// the X position of the grid header. based on the width of the column
// headers (we know this value after the first pass)
xPos float32
}
func newWinCartStatic(img *SdlImgui) (window, error) {
@ -46,6 +42,10 @@ func (win *winCartStatic) id() string {
return winCartStaticTitle
}
func (win *winCartStatic) menuLabel() string {
return winCartStaticTitle
}
func (win *winCartStatic) isOpen() bool {
return win.open
}
@ -77,11 +77,12 @@ func (win *winCartStatic) draw() {
a := win.img.lz.Cart.Static[segment]
b := comp[segment]
if imgui.BeginTabItemV(a.Segment, nil, 0) {
seg := segment
drawByteGrid(a.Data, b.Data, win.img.cols.ValueDiff, 0,
func(addr uint16, data uint8) {
win.img.lz.Dbg.PushRawEvent(func() {
idx := int(addr)
win.img.lz.Dbg.VCS.Mem.Cart.GetRAMbus().PutRAM(segment, idx, data)
win.img.lz.Dbg.VCS.Mem.Cart.GetRAMbus().PutRAM(seg, idx, data)
})
})
imgui.EndTabItem()

View file

@ -49,6 +49,10 @@ func (win *winSuperchargerRegisters) id() string {
return winSuperchargerRegistersTitle
}
func (win *winSuperchargerRegisters) menuLabel() string {
return winSuperchargerRegistersTitle
}
func (win *winSuperchargerRegisters) isOpen() bool {
return win.open
}

View file

@ -47,6 +47,10 @@ func (win *winCartTape) id() string {
return winCartTapeTitle
}
func (win *winCartTape) menuLabel() string {
return winCartTapeTitle
}
func (win *winCartTape) isOpen() bool {
return win.open
}

View file

@ -52,6 +52,10 @@ func (win *winChipRegisters) id() string {
return winChipRegistersTitle
}
func (win *winChipRegisters) menuLabel() string {
return winChipRegistersTitle
}
func (win *winChipRegisters) isOpen() bool {
return win.open
}

View file

@ -49,6 +49,10 @@ func (win *winCollisions) id() string {
return winCollisionsTitle
}
func (win *winCollisions) menuLabel() string {
return winCollisionsTitle
}
func (win *winCollisions) isOpen() bool {
return win.open
}

View file

@ -70,6 +70,10 @@ func (win *winControl) id() string {
return winControlTitle
}
func (win *winControl) menuLabel() string {
return winControlTitle
}
func (win *winControl) isOpen() bool {
return win.open
}

View file

@ -52,6 +52,10 @@ func (win *winControllers) id() string {
return winControllersTitle
}
func (win *winControllers) menuLabel() string {
return winControllersTitle
}
func (win *winControllers) isOpen() bool {
return win.open
}

View file

@ -50,6 +50,10 @@ func (win *winCPU) id() string {
return winCPUTitle
}
func (win *winCPU) menuLabel() string {
return winCPUTitle
}
func (win *winCPU) isOpen() bool {
return win.open
}

View file

@ -66,6 +66,10 @@ func (win *winCRTPrefs) id() string {
return winCRTPrefsTitle
}
func (win *winCRTPrefs) menuLabel() string {
return winCRTPrefsTitle
}
func (win *winCRTPrefs) isOpen() bool {
return win.open
}

View file

@ -132,6 +132,10 @@ func (win *winDbgScr) id() string {
return winDbgScrTitle
}
func (win *winDbgScr) menuLabel() string {
return winDbgScrTitle
}
func (win *winDbgScr) isOpen() bool {
return win.open
}

View file

@ -97,6 +97,10 @@ func (win *winDisasm) id() string {
return winDisasmTitle
}
func (win *winDisasm) menuLabel() string {
return winDisasmTitle
}
func (win *winDisasm) isOpen() bool {
return win.open
}
@ -204,7 +208,6 @@ func (win *winDisasm) draw() {
// unset hasAlignedOnPC if alignOnPC has been set (either by
// pcaddrPrevFramee moving on of the "Goto PC" button being pressed)
win.hasAlignedOnPC = !win.alignOnPC
}
// draw a bank for each tabitem in the tab bar. if there is only one bank then

View file

@ -44,6 +44,10 @@ func (win *winLog) id() string {
return winLogTitle
}
func (win *winLog) menuLabel() string {
return winLogTitle
}
func (win *winLog) isOpen() bool {
return win.open
}

View file

@ -95,6 +95,10 @@ func (win *winPlayScr) id() string {
return winPlayScrTitle
}
func (win *winPlayScr) menuLabel() string {
return winPlayScrTitle
}
func (win *winPlayScr) isOpen() bool {
return win.open
}

View file

@ -55,6 +55,10 @@ func (win *winPlayScrFPS) id() string {
return winPlayScrFPSTitle
}
func (win *winPlayScrFPS) menuLabel() string {
return winPlayScrFPSTitle
}
func (win *winPlayScrFPS) isOpen() bool {
return win.open
}

View file

@ -24,7 +24,7 @@ import (
)
const winPlusROMNetworkTitle = "PlusROM Network"
const menuPlusROMNetworkTitle = "Network"
const winPlusROMNetworkMenu = "Network"
type winPlusROMNetwork struct {
img *SdlImgui
@ -49,6 +49,10 @@ func (win *winPlusROMNetwork) id() string {
return winPlusROMNetworkTitle
}
func (win *winPlusROMNetwork) menuLabel() string {
return winPlusROMNetworkMenu
}
func (win *winPlusROMNetwork) isOpen() bool {
return win.open
}

View file

@ -23,7 +23,7 @@ import (
)
const winPlusROMPrefsTitle = "PlusROM Preferences"
const menuPlusROMPrefsTitle = "Preferences"
const winPlusROMPrefsMenu = "Preferences"
type winPlusROMPrefs struct {
img *SdlImgui
@ -48,6 +48,10 @@ func (win *winPlusROMPrefs) id() string {
return winPlusROMPrefsTitle
}
func (win *winPlusROMPrefs) menuLabel() string {
return winPlusROMPrefsMenu
}
func (win *winPlusROMPrefs) isOpen() bool {
return win.open
}

View file

@ -47,6 +47,10 @@ func (win *winPrefs) id() string {
return winPrefsTile
}
func (win *winPrefs) menuLabel() string {
return winPrefsTile
}
func (win *winPrefs) isOpen() bool {
return win.open
}

View file

@ -42,6 +42,10 @@ func (win *winRAM) id() string {
return winRAMTitle
}
func (win *winRAM) menuLabel() string {
return winRAMTitle
}
func (win *winRAM) isOpen() bool {
return win.open
}

View file

@ -75,6 +75,10 @@ func (win winSelectROM) id() string {
return winSelectROMTitle
}
func (win winSelectROM) menuLabel() string {
return winSelectROMTitle
}
func (win *winSelectROM) isOpen() bool {
return win.open
}
@ -216,7 +220,6 @@ func (win *winSelectROM) draw() {
// control buttons. start controlHeight measurement
win.controlHeight = measureHeight(func() {
imgui.Checkbox("Show all files", &win.showAllFiles)
imgui.SameLine()
imgui.Checkbox("Show hidden entries", &win.showHidden)

View file

@ -24,7 +24,7 @@ import (
)
const winSaveKeyEEPROMTitle = "SaveKey EEPROM"
const menuSaveKeyEEPROMTitle = "EEPROM"
const winSaveKeyEEPROMMenu = "EEPROM"
type winSaveKeyEEPROM struct {
img *SdlImgui
@ -49,6 +49,10 @@ func (win *winSaveKeyEEPROM) id() string {
return winSaveKeyEEPROMTitle
}
func (win *winSaveKeyEEPROM) menuLabel() string {
return winSaveKeyEEPROMMenu
}
func (win *winSaveKeyEEPROM) isOpen() bool {
return win.open
}

View file

@ -24,7 +24,7 @@ import (
)
const winSaveKeyI2CTitle = "SaveKey I2C"
const menuSaveKeyI2CTitle = "I2C"
const winSaveKeyI2CMenu = "I2C"
type winSaveKeyI2C struct {
img *SdlImgui
@ -59,6 +59,10 @@ func (win *winSaveKeyI2C) id() string {
return winSaveKeyI2CTitle
}
func (win *winSaveKeyI2C) menuLabel() string {
return winSaveKeyI2CMenu
}
func (win *winSaveKeyI2C) isOpen() bool {
return win.open
}

View file

@ -70,6 +70,10 @@ func (win *winTerm) id() string {
return winTermTitle
}
func (win *winTerm) menuLabel() string {
return winTermTitle
}
func (win *winTerm) isOpen() bool {
return win.open
}

View file

@ -68,6 +68,10 @@ func (win *winTIA) id() string {
return winTIATitle
}
func (win *winTIA) menuLabel() string {
return winTIATitle
}
func (win *winTIA) isOpen() bool {
return win.open
}

View file

@ -53,6 +53,10 @@ func (win *winTimer) id() string {
return winTimerTitle
}
func (win *winTimer) menuLabel() string {
return winTimerTitle
}
func (win *winTimer) isOpen() bool {
return win.open
}

View file

@ -133,7 +133,7 @@ func (lmtr *limiter) checkScanline() {
}
}
// measures frame rate on every tick of the measuringPulse ticker
// measures frame rate on every tick of the measuringPulse ticker.
func (lmtr *limiter) measureActual() {
select {
case <-lmtr.measuringPulse.C:

View file

@ -114,7 +114,7 @@ const (
// the absolute number of scanlines allowed by the TV regardless of
// specification - value of 32 is the same as the total number of scanlines
// used by the PAL specification
// used by the PAL specification.
const AbsoluteMaxScanlines = 312
// SpecNTSC is the specification for NTSC television types.

View file

@ -467,7 +467,7 @@ func (tv *Television) newFrame(synced bool) error {
// processSignals forwards pixels in the signalHistory buffer to all pixel renderers.
//
// the "current" argument defines how many pixels to push. if all is true then
// the "current" argument defines how many pixels to push. if all is true then.
func (tv *Television) processSignals(current bool) error {
if !tv.pauseRendering {
lmt := tv.currentIdx
@ -486,7 +486,6 @@ func (tv *Television) processSignals(current bool) error {
if tv.reflector != nil {
tv.reflector.SyncReflectionPixel(i)
}
}
r.UpdatingPixels(false)
}

View file

@ -71,7 +71,7 @@ type MissileSprite struct {
lastTickFromHmove bool
// ^^^ the above are common to all sprite types ^^^
//(see player sprite for commentary)
// (see player sprite for commentary)
Color uint8 // equal to missile color
Enabled bool

View file

@ -88,7 +88,7 @@ func CartridgeMemory(mem *cartridge.Cartridge, patchFile string) (bool, error) {
return true, nil
}
// cmp -l <old_file> <new_file>
// cmp -l <old_file> <new_file>.
func cmpStyle(mem *cartridge.Cartridge, buffer []byte) error {
// walk through lines
lines := strings.Split(string(buffer), "\n")