57 lines
1.7 KiB
Groovy
57 lines
1.7 KiB
Groovy
package com.jdbernard.timestamper
|
|
|
|
import java.awt.Color
|
|
import java.awt.Point
|
|
import java.awt.Rectangle
|
|
import java.awt.Toolkit
|
|
import javax.swing.BoxLayout
|
|
import net.miginfocom.swing.MigLayout
|
|
|
|
Point mousePressRelativeToDialog
|
|
Point offsetFromMainFrame
|
|
|
|
mousePressed = { evt -> mousePressRelativeToDialog = evt?.point }
|
|
|
|
mouseDragged = { evt ->
|
|
GUIUtil.componentDragged(view.notesDialog, evt,
|
|
mousePressRelativeToDialog,
|
|
new Rectangle(Toolkit.defaultToolkit.screenSize),
|
|
app.views.TimeStamperMain.frame.bounds)
|
|
|
|
Point p = app.views.TimeStamperMain.frame.location
|
|
offsetFromMainFrame = new Point(notesDialog.location)
|
|
offsetFromMainFrame.translate((int) -p.x, (int) -p.y)
|
|
}
|
|
|
|
notesDialog = dialog(
|
|
title: 'Notes',
|
|
modal: false,
|
|
undecorated: true,
|
|
minimumSize: [325, 200],
|
|
iconImage: imageIcon('/16-em-pencil.png').image,
|
|
iconImages: [imageIcon('/16-em-pencil.png').image],
|
|
location: bind(source: app.models.TimeStamperMain,
|
|
sourceProperty: 'absoluteLocation',
|
|
converter: { loc ->
|
|
Point p = new Point(offsetFromMainFrame)
|
|
p.translate((int) loc.x, (int) loc.y)
|
|
return p})
|
|
) {
|
|
|
|
panel(
|
|
border:lineBorder(color: Color.BLACK, thickness:1, parent:true),
|
|
mousePressed: mousePressed,
|
|
mouseDragged: mouseDragged,
|
|
layout: new MigLayout('insets 5 5 5 5, fill')
|
|
) {
|
|
scrollPane(constraints: 'growx, growy, spany 2') {
|
|
notesTextArea = textArea(lineWrap: true, columns: 20, rows: 5,
|
|
wrapStyleWord: true,
|
|
text: bind(source: app.models.TimeStamperMain,
|
|
sourceProperty: 'currentMarker',
|
|
sourceValue: { app.models.TimeStamperMain.currentMarker?.notes}))
|
|
}
|
|
}
|
|
|
|
}
|