mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-27 01:06:38 +00:00
d5935dfbba
1) Assets window: adds clear list context menu item. 2) Assets window: allow deleting multiple selected items. 3) Assets window: fix list view cursor key navigation. 4) Backend: correctly blend transparent background cursor cells with canvas character cells. 5) Backend: correctly determine cell size & set font size. 6) Backend: correctly unmask cursor. 7) Backend: disable font anti-aliasing on Windows. 8) Backend: render transparent background cells as RGBA #303030FF. 9) Canvas window: adds <F1> accelerator for `View melp?' menu item. 10) Canvas window: implement {dockable,floating} toolbars w/ wx' AUI framework. 11) Canvas window: separate tools toolbar from edit commands toolbar & dock both on right-hand side alongside each other. 12) Flip horizontally tool: flip characters, including some Unicode symbols. 13) Flip vertically tool: flip additional Unicode symbols. 14) Text tool: don't process keyboard events w/ either of <{Alt,AltGr,Ctrl}> modifiers. assets/images/roar.png: updated.
64 lines
2.4 KiB
Python
64 lines
2.4 KiB
Python
#!/usr/bin/env python3
|
|
#
|
|
# GuiWindow.py
|
|
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
|
#
|
|
|
|
import wx
|
|
|
|
class GuiWindow(wx.ScrolledWindow):
|
|
def _updateScrollBars(self):
|
|
if (self.scrollStep != None) and (self.size != None):
|
|
self.SetScrollRate(*self.scrollStep); clientSize = self.GetClientSize();
|
|
if (self.size[0] > clientSize[0]) or (self.size[1] > clientSize[1]):
|
|
self.scrollFlag = True; super().SetVirtualSize(self.size);
|
|
elif self.scrollFlag \
|
|
and ((self.size[0] <= clientSize[0]) or (self.size[1] <= clientSize[1])):
|
|
self.scrollFlag = False; super().SetVirtualSize((0, 0));
|
|
|
|
def onClose(self, event):
|
|
self.Destroy()
|
|
|
|
def onEnterWindow(self, event):
|
|
event.Skip()
|
|
|
|
def onKeyboardInput(self, event):
|
|
return False
|
|
|
|
def onLeaveWindow(self, event):
|
|
event.Skip()
|
|
|
|
def onMouseInput(self, event):
|
|
return False
|
|
|
|
def onPaint(self, event):
|
|
event.Skip()
|
|
|
|
def onScroll(self, event):
|
|
event.Skip()
|
|
|
|
def onSize(self, event):
|
|
self._updateScrollBars(); event.Skip();
|
|
|
|
def resize(self, newSize):
|
|
self.size = newSize; self._updateScrollBars();
|
|
self.SetMinSize(self.size); self.SetSize(wx.DefaultCoord, wx.DefaultCoord, *self.size);
|
|
self.SetMinSize(self.parent.GetSize()); self.SetSize(wx.DefaultCoord, wx.DefaultCoord, *self.parent.GetSize())
|
|
curWindow = self
|
|
while curWindow != None:
|
|
curWindow.Layout(); curWindow = curWindow.GetParent();
|
|
|
|
def __init__(self, parent, pos, style=0):
|
|
super().__init__(parent, pos=pos, style=style) if style != 0 else super().__init__(parent, pos=pos)
|
|
self.parent = parent
|
|
self.pos, self.scrollFlag, self.scrollStep, self.size = pos, False, None, None
|
|
for eventType, f in (
|
|
(wx.EVT_CHAR, self.onKeyboardInput), (wx.EVT_CLOSE, self.onClose), (wx.EVT_ENTER_WINDOW, self.onEnterWindow),
|
|
(wx.EVT_LEAVE_WINDOW, self.onLeaveWindow), (wx.EVT_LEFT_DOWN, self.onMouseInput), (wx.EVT_MOTION, self.onMouseInput),
|
|
(wx.EVT_PAINT, self.onPaint), (wx.EVT_RIGHT_DOWN, self.onMouseInput), (wx.EVT_SCROLLWIN_LINEDOWN, self.onScroll),
|
|
(wx.EVT_SCROLLWIN_LINEUP, self.onScroll), (wx.EVT_SIZE, self.onSize)):
|
|
self.Bind(eventType, f)
|
|
self._updateScrollBars()
|
|
|
|
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|