mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-22 15:26:37 +00:00
Implements pick colour tool.
assets/text/TODO: updated.
This commit is contained in:
parent
51498169e0
commit
79d310d331
BIN
assets/images/toolPickColour.png
Normal file
BIN
assets/images/toolPickColour.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 220 B |
@ -24,8 +24,8 @@ High-priority list:
|
|||||||
2) bug: a) new canvas/startup b) place rect c) move mouse d) undo status changes
|
2) bug: a) new canvas/startup b) place rect c) move mouse d) undo status changes
|
||||||
3) bug: a) start w/ spoke-vxplion.txt b) scroll down c) fix w/ canvas resize
|
3) bug: a) start w/ spoke-vxplion.txt b) scroll down c) fix w/ canvas resize
|
||||||
4) add hotkeys.txt mIRC art canvas to help menu
|
4) add hotkeys.txt mIRC art canvas to help menu
|
||||||
5) tools: pick colour, unicode block elements
|
5) bug: a) text tool b) paste text c) undo
|
||||||
6) bug: a) text tool b) paste text c) undo
|
6) bug: a) tile once b) tile twice
|
||||||
7) bug: a) tile once b) tile twice
|
7) tools: unicode block elements
|
||||||
|
|
||||||
vim:ff=dos tw=0
|
vim:ff=dos tw=0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Ctrl> 0-9, <Ctrl> <Shift> 0-5, <Ctrl> <Shift> 6 Set foreground colour to #0-9, #10-15, transparent colour, resp.
|
<Ctrl> 0-9, <Ctrl> <Shift> 0-5, <Ctrl> <Shift> 6 Set foreground colour to #0-9, #10-15, transparent colour, resp.
|
||||||
<Ctrl> <Alt> 0-9, <Ctrl> <Alt> <Shift> 0-5, <Ctrl> <Alt> <Shift> 6 Set background colour to #0-9, #10-15, transparent colour, resp.
|
<Ctrl> <Alt> 0-9, <Ctrl> <Alt> <Shift> 0-5, <Ctrl> <Alt> <Shift> 6 Set background colour to #0-9, #10-15, transparent colour, resp.
|
||||||
<Ctrl> C, U, E, F, L, R, E, T Switch to circle, cursor, erase, fill, line, rectangle, object, text tool
|
<Ctrl> C, U, E, F, L, P, R, E, T Switch to circle, cursor, erase, fill, line, pick colour, rectangle, object, text tool
|
||||||
<Ctrl> I Flip colours
|
<Ctrl> I Flip colours
|
||||||
<Ctrl> N New canvas
|
<Ctrl> N New canvas
|
||||||
<Ctrl> O Open mIRC art file
|
<Ctrl> O Open mIRC art file
|
||||||
|
@ -129,7 +129,7 @@ class RoarCanvasCommands(RoarCanvasCommandsFile, RoarCanvasCommandsEdit, RoarCan
|
|||||||
self.canvasUndo, self.canvasRedo, NID_TOOLBAR_HSEP,
|
self.canvasUndo, self.canvasRedo, NID_TOOLBAR_HSEP,
|
||||||
self.canvasCut, self.canvasCopy, self.canvasPaste, self.canvasDelete, NID_TOOLBAR_HSEP,
|
self.canvasCut, self.canvasCopy, self.canvasPaste, self.canvasDelete, NID_TOOLBAR_HSEP,
|
||||||
self.canvasAssetsWindowHide, self.canvasAssetsWindowShow, NID_TOOLBAR_HSEP,
|
self.canvasAssetsWindowHide, self.canvasAssetsWindowShow, NID_TOOLBAR_HSEP,
|
||||||
self.canvasTool(self.canvasTool, 1), self.canvasTool(self.canvasTool, 6), self.canvasTool(self.canvasTool, 0), self.canvasTool(self.canvasTool, 3), self.canvasTool(self.canvasTool, 4), self.canvasTool(self.canvasTool, 7), self.canvasTool(self.canvasTool, 5), self.canvasTool(self.canvasTool, 2),
|
self.canvasTool(self.canvasTool, 1), self.canvasTool(self.canvasTool, 7), self.canvasTool(self.canvasTool, 0), self.canvasTool(self.canvasTool, 3), self.canvasTool(self.canvasTool, 4), self.canvasTool(self.canvasTool, 8), self.canvasTool(self.canvasTool, 5), self.canvasTool(self.canvasTool, 2), self.canvasTool(self.canvasTool, 6),
|
||||||
])
|
])
|
||||||
toolBars.append(
|
toolBars.append(
|
||||||
[self.canvasColour(self.canvasColour, 0), self.canvasColour(self.canvasColour, 1), self.canvasColour(self.canvasColour, 2), self.canvasColour(self.canvasColour, 3),
|
[self.canvasColour(self.canvasColour, 0), self.canvasColour(self.canvasColour, 1), self.canvasColour(self.canvasColour, 2), self.canvasColour(self.canvasColour, 3),
|
||||||
|
@ -10,6 +10,7 @@ from ToolErase import ToolErase
|
|||||||
from ToolFill import ToolFill
|
from ToolFill import ToolFill
|
||||||
from ToolLine import ToolLine
|
from ToolLine import ToolLine
|
||||||
from ToolObject import ToolObject
|
from ToolObject import ToolObject
|
||||||
|
from ToolPickColour import ToolPickColour
|
||||||
from ToolRect import ToolRect
|
from ToolRect import ToolRect
|
||||||
from ToolText import ToolText
|
from ToolText import ToolText
|
||||||
import wx
|
import wx
|
||||||
@ -21,15 +22,16 @@ class RoarCanvasCommandsTools():
|
|||||||
@GuiSelectDecorator(3, "Fill", "&Fill", ["toolFill.png"], [wx.ACCEL_CTRL, ord("F")], False)
|
@GuiSelectDecorator(3, "Fill", "&Fill", ["toolFill.png"], [wx.ACCEL_CTRL, ord("F")], False)
|
||||||
@GuiSelectDecorator(4, "Line", "&Line", ["toolLine.png"], [wx.ACCEL_CTRL, ord("L")], False)
|
@GuiSelectDecorator(4, "Line", "&Line", ["toolLine.png"], [wx.ACCEL_CTRL, ord("L")], False)
|
||||||
@GuiSelectDecorator(5, "Object", "&Object", ["toolObject.png"], [wx.ACCEL_CTRL, ord("E")], False)
|
@GuiSelectDecorator(5, "Object", "&Object", ["toolObject.png"], [wx.ACCEL_CTRL, ord("E")], False)
|
||||||
@GuiSelectDecorator(6, "Rectangle", "&Rectangle", ["toolRect.png"], [wx.ACCEL_CTRL, ord("R")], True)
|
@GuiSelectDecorator(6, "Pick colour", "&Pick colour", ["toolPickColour.png"], [wx.ACCEL_CTRL, ord("P")], False)
|
||||||
@GuiSelectDecorator(7, "Text", "&Text", ["toolText.png"], [wx.ACCEL_CTRL, ord("T")], False)
|
@GuiSelectDecorator(7, "Rectangle", "&Rectangle", ["toolRect.png"], [wx.ACCEL_CTRL, ord("R")], True)
|
||||||
|
@GuiSelectDecorator(8, "Text", "&Text", ["toolText.png"], [wx.ACCEL_CTRL, ord("T")], False)
|
||||||
def canvasTool(self, f, idx):
|
def canvasTool(self, f, idx):
|
||||||
def canvasTool_(event):
|
def canvasTool_(event):
|
||||||
if (self.currentTool.__class__ == ToolObject) \
|
if (self.currentTool.__class__ == ToolObject) \
|
||||||
and (self.currentTool.toolState > self.currentTool.TS_NONE) \
|
and (self.currentTool.toolState > self.currentTool.TS_NONE) \
|
||||||
and self.currentTool.external:
|
and self.currentTool.external:
|
||||||
self.parentCanvas.dropTarget.done()
|
self.parentCanvas.dropTarget.done()
|
||||||
self.lastTool, self.currentTool = self.currentTool, [ToolCircle, None, ToolErase, ToolFill, ToolLine, ToolObject, ToolRect, ToolText][idx]
|
self.lastTool, self.currentTool = self.currentTool, [ToolCircle, None, ToolErase, ToolFill, ToolLine, ToolObject, ToolPickColour, ToolRect, ToolText][idx]
|
||||||
if self.currentTool != None:
|
if self.currentTool != None:
|
||||||
self.currentTool = self.currentTool()
|
self.currentTool = self.currentTool()
|
||||||
self.currentOperator, self.operatorState = None, None
|
self.currentOperator, self.operatorState = None, None
|
||||||
@ -53,7 +55,7 @@ class RoarCanvasCommandsTools():
|
|||||||
self.accels = ()
|
self.accels = ()
|
||||||
self.menus = (
|
self.menus = (
|
||||||
("&Tools",
|
("&Tools",
|
||||||
self.canvasTool(self.canvasTool, 1), self.canvasTool(self.canvasTool, 6), self.canvasTool(self.canvasTool, 0), self.canvasTool(self.canvasTool, 3), self.canvasTool(self.canvasTool, 4), self.canvasTool(self.canvasTool, 7), self.canvasTool(self.canvasTool, 5), self.canvasTool(self.canvasTool, 2),
|
self.canvasTool(self.canvasTool, 1), self.canvasTool(self.canvasTool, 7), self.canvasTool(self.canvasTool, 0), self.canvasTool(self.canvasTool, 3), self.canvasTool(self.canvasTool, 4), self.canvasTool(self.canvasTool, 8), self.canvasTool(self.canvasTool, 5), self.canvasTool(self.canvasTool, 2), self.canvasTool(self.canvasTool, 6),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
self.toolBars = ()
|
self.toolBars = ()
|
||||||
|
27
libtools/ToolPickColour.py
Normal file
27
libtools/ToolPickColour.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# ToolPickColour.py
|
||||||
|
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
|
#
|
||||||
|
|
||||||
|
from Tool import Tool
|
||||||
|
|
||||||
|
class ToolPickColour(Tool):
|
||||||
|
name = "Pick colour"
|
||||||
|
|
||||||
|
#
|
||||||
|
# onMouseEvent(self, atPoint, brushColours, brushPos, brushSize, canvas, dispatchFn, eventDc, keyModifiers, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown)
|
||||||
|
def onMouseEvent(self, atPoint, brushColours, brushPos, brushSize, canvas, dispatchFn, eventDc, keyModifiers, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown):
|
||||||
|
if (mapPoint[0] < canvas.size[0]) \
|
||||||
|
and (mapPoint[1] < canvas.size[1]):
|
||||||
|
if mouseLeftDown:
|
||||||
|
if canvas.map[mapPoint[1]][mapPoint[0]][3] == " ":
|
||||||
|
brushColours[0] = canvas.map[mapPoint[1]][mapPoint[0]][1]
|
||||||
|
else:
|
||||||
|
brushColours[0] = canvas.map[mapPoint[1]][mapPoint[0]][0]
|
||||||
|
elif mouseRightDown:
|
||||||
|
brushColours[1] = canvas.map[mapPoint[1]][mapPoint[0]][1]
|
||||||
|
dispatchFn(eventDc, True, [*mapPoint, *brushColours, 0, "░"])
|
||||||
|
return True, False
|
||||||
|
|
||||||
|
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|
Loading…
Reference in New Issue
Block a user