* Taseditor: fixed known WinXP bug with scrollbar arrows
* Taseditor: 2x faster scrolling * Taseditor: branch description text size = size of edit fields * Taseditor: observing Piano Roll with right button
This commit is contained in:
parent
1e98a31332
commit
1eadc6f533
|
@ -770,7 +770,7 @@ void BOOKMARKS::RedrawBranchesTree()
|
|||
branch = bookmarks_array[branch].parent_branch;
|
||||
if (branch >= 0)
|
||||
{
|
||||
branch_x = BranchCurrX[branch];
|
||||
branch_x = BranchCurrX[branch];
|
||||
branch_y = BranchCurrY[branch];
|
||||
} else
|
||||
{
|
||||
|
@ -839,6 +839,7 @@ void BOOKMARKS::RedrawBranchesTree()
|
|||
BitBlt(hBitmapDC, branch_x, branch_y, DIGIT_BITMAP_WIDTH, DIGIT_BITMAP_HEIGHT, hSpritesheetDC, i * DIGIT_BITMAP_WIDTH, 0, SRCCOPY);
|
||||
}
|
||||
}
|
||||
SetBkMode(hBitmapDC, TRANSPARENT);
|
||||
// jump_frame of item under cursor (except cloud - it doesn't have particular frame)
|
||||
if (item_under_mouse > ITEM_UNDER_MOUSE_CLOUD)
|
||||
{
|
||||
|
@ -847,17 +848,34 @@ void BOOKMARKS::RedrawBranchesTree()
|
|||
U32ToDecStr(framenum_string, bookmarks_array[item_under_mouse].snapshot.jump_frame, DIGITS_IN_FRAMENUM);
|
||||
else
|
||||
U32ToDecStr(framenum_string, currFrameCounter, DIGITS_IN_FRAMENUM);
|
||||
SetTextColor(hBitmapDC, BRANCHES_TEXT_SHADOW_COLOR);
|
||||
TextOut(hBitmapDC, BRANCHES_BITMAP_FRAMENUM_X + 1, BRANCHES_BITMAP_FRAMENUM_Y + 1, (LPCSTR)framenum_string, DIGITS_IN_FRAMENUM);
|
||||
SetTextColor(hBitmapDC, BRANCHES_TEXT_COLOR);
|
||||
TextOut(hBitmapDC, BRANCHES_BITMAP_FRAMENUM_X, BRANCHES_BITMAP_FRAMENUM_Y, (LPCSTR)framenum_string, DIGITS_IN_FRAMENUM);
|
||||
}
|
||||
// time of item under cursor
|
||||
if (item_under_mouse > ITEM_UNDER_MOUSE_NONE)
|
||||
{
|
||||
if (item_under_mouse == ITEM_UNDER_MOUSE_CLOUD)
|
||||
{
|
||||
// draw shadow of text
|
||||
SetTextColor(hBitmapDC, BRANCHES_TEXT_SHADOW_COLOR);
|
||||
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X + 1, BRANCHES_BITMAP_TIME_Y + 1, (LPCSTR)cloud_time, TIME_DESC_LENGTH-1);
|
||||
SetTextColor(hBitmapDC, BRANCHES_TEXT_COLOR);
|
||||
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X, BRANCHES_BITMAP_TIME_Y, (LPCSTR)cloud_time, TIME_DESC_LENGTH-1);
|
||||
else if (item_under_mouse < TOTAL_BOOKMARKS)
|
||||
} else if (item_under_mouse < TOTAL_BOOKMARKS)
|
||||
{
|
||||
SetTextColor(hBitmapDC, BRANCHES_TEXT_SHADOW_COLOR);
|
||||
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X + 1, BRANCHES_BITMAP_TIME_Y + 1, (LPCSTR)bookmarks_array[item_under_mouse].snapshot.description, TIME_DESC_LENGTH-1);
|
||||
SetTextColor(hBitmapDC, BRANCHES_TEXT_COLOR);
|
||||
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X, BRANCHES_BITMAP_TIME_Y, (LPCSTR)bookmarks_array[item_under_mouse].snapshot.description, TIME_DESC_LENGTH-1);
|
||||
else
|
||||
} else // fireball - current_pos_time
|
||||
{
|
||||
SetTextColor(hBitmapDC, BRANCHES_TEXT_SHADOW_COLOR);
|
||||
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X + 1, BRANCHES_BITMAP_TIME_Y + 1, (LPCSTR)current_pos_time, TIME_DESC_LENGTH-1);
|
||||
SetTextColor(hBitmapDC, BRANCHES_TEXT_COLOR);
|
||||
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X, BRANCHES_BITMAP_TIME_Y, (LPCSTR)current_pos_time, TIME_DESC_LENGTH-1);
|
||||
}
|
||||
}
|
||||
// finished
|
||||
must_redraw_branches_tree = false;
|
||||
|
@ -931,11 +949,11 @@ void BOOKMARKS::CheckMousePos()
|
|||
// find item under mouse
|
||||
item_under_mouse = ITEM_UNDER_MOUSE_NONE;
|
||||
for (int i = 0; i < TOTAL_BOOKMARKS; ++i)
|
||||
if (item_under_mouse == ITEM_UNDER_MOUSE_NONE && mouse_x >= BranchCurrX[i] - DIGIT_RECT_HALFWIDTH && mouse_x < BranchCurrX[i] - DIGIT_RECT_HALFWIDTH + DIGIT_RECT_WIDTH && mouse_y >= BranchCurrY[i] - DIGIT_RECT_HALFHEIGHT && mouse_y < BranchCurrY[i] - DIGIT_RECT_HALFHEIGHT + DIGIT_RECT_HEIGHT)
|
||||
if (item_under_mouse == ITEM_UNDER_MOUSE_NONE && mouse_x >= BranchCurrX[i] - DIGIT_RECT_HALFWIDTH_COLLISION && mouse_x < BranchCurrX[i] - DIGIT_RECT_HALFWIDTH_COLLISION + DIGIT_RECT_WIDTH_COLLISION && mouse_y >= BranchCurrY[i] - DIGIT_RECT_HALFHEIGHT_COLLISION && mouse_y < BranchCurrY[i] - DIGIT_RECT_HALFHEIGHT_COLLISION + DIGIT_RECT_HEIGHT_COLLISION)
|
||||
item_under_mouse = i;
|
||||
if (item_under_mouse == ITEM_UNDER_MOUSE_NONE && mouse_x >= cloud_x - BRANCHES_CLOUD_HALFWIDTH && mouse_x < cloud_x - BRANCHES_CLOUD_HALFWIDTH + BRANCHES_CLOUD_WIDTH && mouse_y >= BRANCHES_CLOUD_Y - BRANCHES_CLOUD_HALFHEIGHT && mouse_y < BRANCHES_CLOUD_Y - BRANCHES_CLOUD_HALFHEIGHT + BRANCHES_CLOUD_HEIGHT)
|
||||
item_under_mouse = ITEM_UNDER_MOUSE_CLOUD;
|
||||
if (item_under_mouse == ITEM_UNDER_MOUSE_NONE && changes_since_current_branch && mouse_x >= BranchCurrX[TOTAL_BOOKMARKS] - DIGIT_RECT_HALFWIDTH && mouse_x < BranchCurrX[TOTAL_BOOKMARKS] - DIGIT_RECT_HALFWIDTH + DIGIT_RECT_WIDTH && mouse_y >= BranchCurrY[TOTAL_BOOKMARKS] - DIGIT_RECT_HALFHEIGHT && mouse_y < BranchCurrY[TOTAL_BOOKMARKS] - DIGIT_RECT_HALFHEIGHT + DIGIT_RECT_HEIGHT)
|
||||
if (item_under_mouse == ITEM_UNDER_MOUSE_NONE && changes_since_current_branch && mouse_x >= BranchCurrX[TOTAL_BOOKMARKS] - DIGIT_RECT_HALFWIDTH_COLLISION && mouse_x < BranchCurrX[TOTAL_BOOKMARKS] - DIGIT_RECT_HALFWIDTH_COLLISION + DIGIT_RECT_WIDTH_COLLISION && mouse_y >= BranchCurrY[TOTAL_BOOKMARKS] - DIGIT_RECT_HALFHEIGHT_COLLISION && mouse_y < BranchCurrY[TOTAL_BOOKMARKS] - DIGIT_RECT_HALFHEIGHT_COLLISION + DIGIT_RECT_HEIGHT_COLLISION)
|
||||
item_under_mouse = TOTAL_BOOKMARKS;
|
||||
if (prev_item_under_mouse != item_under_mouse)
|
||||
must_redraw_branches_tree = true;
|
||||
|
|
|
@ -30,10 +30,12 @@ enum COMMANDS
|
|||
#define BRANCHES_BITMAP_WIDTH 170
|
||||
#define BRANCHES_BITMAP_HEIGHT 145
|
||||
#define BRANCHES_ANIMATION_FRAMES 12
|
||||
#define BRANCHES_BITMAP_FRAMENUM_X 0
|
||||
#define BRANCHES_BITMAP_FRAMENUM_Y 0
|
||||
#define BRANCHES_BITMAP_TIME_X 0
|
||||
#define BRANCHES_BITMAP_FRAMENUM_X 2
|
||||
#define BRANCHES_BITMAP_FRAMENUM_Y 1
|
||||
#define BRANCHES_BITMAP_TIME_X 2
|
||||
#define BRANCHES_BITMAP_TIME_Y BRANCHES_BITMAP_HEIGHT - 17
|
||||
#define BRANCHES_TEXT_SHADOW_COLOR 0xFFFFFF
|
||||
#define BRANCHES_TEXT_COLOR 0x7F0000
|
||||
// constants for drawing branches tree
|
||||
#define BRANCHES_CANVAS_WIDTH 146
|
||||
#define BRANCHES_CANVAS_HEIGHT 130
|
||||
|
@ -58,9 +60,13 @@ enum COMMANDS
|
|||
#define BLUE_DIGITS_SPRITESHEET_DX DIGIT_BITMAP_WIDTH*TOTAL_BOOKMARKS
|
||||
#define MOUSEOVER_DIGITS_SPRITESHEET_DY DIGIT_BITMAP_HEIGHT
|
||||
#define DIGIT_RECT_WIDTH 11
|
||||
#define DIGIT_RECT_WIDTH_COLLISION (DIGIT_RECT_WIDTH + 2)
|
||||
#define DIGIT_RECT_HALFWIDTH DIGIT_RECT_WIDTH/2
|
||||
#define DIGIT_RECT_HALFWIDTH_COLLISION (DIGIT_RECT_HALFWIDTH + 1)
|
||||
#define DIGIT_RECT_HEIGHT 15
|
||||
#define DIGIT_RECT_HEIGHT_COLLISION (DIGIT_RECT_HEIGHT + 2)
|
||||
#define DIGIT_RECT_HALFHEIGHT DIGIT_RECT_HEIGHT/2
|
||||
#define DIGIT_RECT_HALFHEIGHT_COLLISION (DIGIT_RECT_HALFHEIGHT + 1)
|
||||
#define BRANCHES_CLOUD_WIDTH 26
|
||||
#define BRANCHES_CLOUD_HALFWIDTH BRANCHES_CLOUD_WIDTH/2
|
||||
#define BRANCHES_CLOUD_HEIGHT 15
|
||||
|
|
|
@ -227,6 +227,12 @@ void PIANO_ROLL::init()
|
|||
list_row_height = 14;
|
||||
}
|
||||
ListView_SetItemCountEx(hwndList, 0, LVSICF_NOSCROLL|LVSICF_NOINVALIDATEALL);
|
||||
// find header height
|
||||
RECT wrect;
|
||||
if (GetWindowRect(hwndHeader, &wrect))
|
||||
list_header_height = wrect.bottom - wrect.top;
|
||||
else
|
||||
list_header_height = 20;
|
||||
|
||||
hrmenu = LoadMenu(fceu_hInstance,"TASEDITORCONTEXTMENUS");
|
||||
header_colors.resize(TOTAL_COLUMNS);
|
||||
|
@ -235,6 +241,7 @@ void PIANO_ROLL::init()
|
|||
tme.dwFlags = TME_LEAVE;
|
||||
tme.hwndTrack = hwndHeader;
|
||||
drag_mode = DRAG_MODE_NONE;
|
||||
rbutton_drag_mode = false;
|
||||
}
|
||||
void PIANO_ROLL::free()
|
||||
{
|
||||
|
@ -341,24 +348,30 @@ void PIANO_ROLL::update()
|
|||
if (GetAsyncKeyState(GetSystemMetrics(SM_SWAPBUTTON) ? VK_RBUTTON : VK_LBUTTON) >= 0)
|
||||
FinishDrag();
|
||||
}
|
||||
// also scroll Piano Roll if user is dragging cursor outside
|
||||
if (drag_mode != DRAG_MODE_NONE)
|
||||
if (rbutton_drag_mode)
|
||||
{
|
||||
// check if user released right button
|
||||
if (GetAsyncKeyState(GetSystemMetrics(SM_SWAPBUTTON) ? VK_LBUTTON : VK_RBUTTON) >= 0)
|
||||
rbutton_drag_mode = false;
|
||||
}
|
||||
// scroll Piano Roll if user is dragging cursor outside
|
||||
if (drag_mode != DRAG_MODE_NONE || rbutton_drag_mode)
|
||||
{
|
||||
POINT p;
|
||||
if (GetCursorPos(&p))
|
||||
{
|
||||
int scroll_dx = 0, scroll_dy = 0;
|
||||
RECT wrect;
|
||||
GetWindowRect(hwndList, &wrect);
|
||||
ScreenToClient(hwndList, &p);
|
||||
if (p.x < 0)
|
||||
scroll_dx = p.x;
|
||||
else if (p.x > (wrect.right - wrect.left))
|
||||
scroll_dx = p.x - (wrect.right - wrect.left);
|
||||
if (p.y < 0)
|
||||
scroll_dy = p.y;
|
||||
else if (p.y > (wrect.bottom - wrect.top))
|
||||
scroll_dy = p.y - (wrect.bottom - wrect.top);
|
||||
RECT wrect;
|
||||
GetClientRect(hwndList, &wrect);
|
||||
int scroll_dx = 0, scroll_dy = 0;
|
||||
if (p.x < SCROLLING_BORDER_SIZE)
|
||||
scroll_dx = p.x - SCROLLING_BORDER_SIZE;
|
||||
else if (p.x > (wrect.right - wrect.left - SCROLLING_BORDER_SIZE))
|
||||
scroll_dx = p.x - (wrect.right - wrect.left - SCROLLING_BORDER_SIZE);
|
||||
if (p.y < (list_header_height + SCROLLING_BORDER_SIZE))
|
||||
scroll_dy = p.y - (list_header_height + SCROLLING_BORDER_SIZE);
|
||||
else if (p.y > (wrect.bottom - wrect.top - SCROLLING_BORDER_SIZE))
|
||||
scroll_dy = p.y - (wrect.bottom - wrect.top - SCROLLING_BORDER_SIZE);
|
||||
if (scroll_dx || scroll_dy)
|
||||
ListView_Scroll(hwndList, scroll_dx, scroll_dy);
|
||||
}
|
||||
|
@ -368,8 +381,7 @@ void PIANO_ROLL::update()
|
|||
{
|
||||
case DRAG_MODE_PLAYBACK:
|
||||
{
|
||||
if (!playback.pause_frame)
|
||||
DragPlaybackCursor();
|
||||
DragPlaybackCursor();
|
||||
break;
|
||||
}
|
||||
case DRAG_MODE_MARKER:
|
||||
|
@ -411,8 +423,6 @@ void PIANO_ROLL::update()
|
|||
POINT p;
|
||||
if (GetCursorPos(&p))
|
||||
{
|
||||
RECT wrect;
|
||||
GetWindowRect(hwndList, &wrect);
|
||||
ScreenToClient(hwndList, &p);
|
||||
int drawing_current_x = p.x + GetScrollPos(hwndList, SB_HORZ);
|
||||
int drawing_current_y = p.y + GetScrollPos(hwndList, SB_VERT) * list_row_height;
|
||||
|
@ -521,10 +531,10 @@ void PIANO_ROLL::update()
|
|||
POINT p;
|
||||
if (GetCursorPos(&p))
|
||||
{
|
||||
RECT wrect;
|
||||
GetWindowRect(hwndList, &wrect);
|
||||
ScreenToClient(hwndList, &p);
|
||||
if (p.x >= 0 && p.y >= 0 && p.x < (wrect.right - wrect.left) && p.y < (wrect.bottom - wrect.top))
|
||||
RECT wrect;
|
||||
GetClientRect(hwndList, &wrect);
|
||||
if (p.x >= 0 && p.y >= list_header_height && p.x < (wrect.right - wrect.left) && p.y < (wrect.bottom - wrect.top))
|
||||
{
|
||||
// perform hit test
|
||||
LVHITTESTINFO info;
|
||||
|
@ -1466,11 +1476,22 @@ LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
if ((int)(piano_roll.vk_control_release_time + GetDoubleClickTime()) > clock())
|
||||
piano_roll.FollowSelection();
|
||||
}
|
||||
// only allow 8 keys
|
||||
if (taseditor_config.keyboard_for_piano_roll && (wParam == VK_LEFT || wParam == VK_UP || wParam == VK_RIGHT || wParam == VK_DOWN || wParam == VK_END || wParam == VK_HOME || wParam == VK_PRIOR || wParam == VK_NEXT))
|
||||
if (taseditor_config.keyboard_for_piano_roll)
|
||||
{
|
||||
piano_roll.must_check_item_under_mouse = true;
|
||||
break;
|
||||
// only allow 8 keys, and change behaviour of Right and Left keys
|
||||
if (wParam == VK_LEFT)
|
||||
{
|
||||
// faster speed of horizontal scrolling, and don't scroll vertically to the selection
|
||||
ListView_Scroll(piano_roll.hwndList, -COLUMN_BUTTON_WIDTH, 0);
|
||||
} else if (wParam == VK_RIGHT)
|
||||
{
|
||||
ListView_Scroll(piano_roll.hwndList, COLUMN_BUTTON_WIDTH, 0);
|
||||
} else if (wParam == VK_UP || wParam == VK_DOWN || wParam == VK_END || wParam == VK_HOME || wParam == VK_PRIOR || wParam == VK_NEXT)
|
||||
{
|
||||
// these 6 keys will be handled by hwndList_oldWndProc
|
||||
piano_roll.must_check_item_under_mouse = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1492,7 +1513,6 @@ LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
if(column_index == COLUMN_ICONS)
|
||||
{
|
||||
// click on the "icons" column
|
||||
piano_roll.DragPlaybackCursor();
|
||||
if (piano_roll.drag_mode == DRAG_MODE_NONE)
|
||||
piano_roll.drag_mode = DRAG_MODE_PLAYBACK;
|
||||
} else if(column_index == COLUMN_FRAMENUM || column_index == COLUMN_FRAMENUM2)
|
||||
|
@ -1504,11 +1524,7 @@ LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
if (taseditor_config.deselect_on_doubleclick)
|
||||
selection.ClearSelection();
|
||||
if (taseditor_config.doubleclick_affects_playback)
|
||||
{
|
||||
piano_roll.DragPlaybackCursor();
|
||||
if (piano_roll.drag_mode == DRAG_MODE_NONE)
|
||||
piano_roll.drag_mode = DRAG_MODE_PLAYBACK;
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (row_index >= 0)
|
||||
|
@ -1611,23 +1627,23 @@ LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
// Shift + wheel = Playback rewind full(speed)/forward full(speed)
|
||||
if (zDelta < 0)
|
||||
playback.ForwardFull(-zDelta / 120);
|
||||
playback.ForwardFull(-zDelta / WHEEL_DELTA);
|
||||
else if (zDelta > 0)
|
||||
playback.RewindFull(zDelta / 120);
|
||||
playback.RewindFull(zDelta / WHEEL_DELTA);
|
||||
} else if (fwKeys & MK_CONTROL)
|
||||
{
|
||||
// Ctrl + wheel = Selection rewind full(speed)/forward full(speed)
|
||||
if (zDelta < 0)
|
||||
selection.JumpNextMarker(-zDelta / 120);
|
||||
selection.JumpNextMarker(-zDelta / WHEEL_DELTA);
|
||||
else if (zDelta > 0)
|
||||
selection.JumpPrevMarker(zDelta / 120);
|
||||
selection.JumpPrevMarker(zDelta / WHEEL_DELTA);
|
||||
} else if (alt_pressed || fwKeys & MK_RBUTTON)
|
||||
{
|
||||
// Right button + wheel = Alt + wheel = rewind/forward
|
||||
// if both Right button and Alt are pressed, move 2x faster
|
||||
// if both Right button and Alt are pressed, move 4x faster
|
||||
if (alt_pressed && fwKeys & MK_RBUTTON)
|
||||
zDelta *= BOOST_WHEN_BOTH_RIGHTBUTTON_AND_ALT_PRESSED;
|
||||
int destination_frame = currFrameCounter - (zDelta / 120);
|
||||
int destination_frame = currFrameCounter - (zDelta / WHEEL_DELTA);
|
||||
if (destination_frame < 0) destination_frame = 0;
|
||||
int lastCursor = currFrameCounter;
|
||||
playback.jump(destination_frame);
|
||||
|
@ -1642,13 +1658,14 @@ LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
return SendMessage(history.hwndHistoryList, WM_MOUSEWHEEL_RESENT, wParam, lParam);
|
||||
} else
|
||||
{
|
||||
// normal scrolling
|
||||
CallWindowProc(hwndList_oldWndProc, hWnd, msg, wParam, lParam);
|
||||
// normal scrolling - make it 2x faster than usual
|
||||
CallWindowProc(hwndList_oldWndProc, hWnd, msg, MAKELONG(fwKeys, zDelta * PIANO_ROLL_SCROLLING_BOOST), lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
case WM_RBUTTONDOWN:
|
||||
case WM_RBUTTONDBLCLK:
|
||||
piano_roll.rbutton_drag_mode = true;
|
||||
if (GetFocus() != hWnd)
|
||||
SetFocus(hWnd);
|
||||
return 0;
|
||||
|
@ -1676,7 +1693,6 @@ LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
// user clicked on left border of the Piano Roll
|
||||
// consider this as a "misclick" on Piano Roll's first column
|
||||
piano_roll.DragPlaybackCursor();
|
||||
if (piano_roll.drag_mode == DRAG_MODE_NONE)
|
||||
piano_roll.drag_mode = DRAG_MODE_PLAYBACK;
|
||||
return 0;
|
||||
|
@ -1692,9 +1708,37 @@ LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
case LVM_ENSUREVISIBLE:
|
||||
{
|
||||
// Piano Roll probably scrolls
|
||||
piano_roll.must_check_item_under_mouse = true;
|
||||
break;
|
||||
}
|
||||
case WM_VSCROLL:
|
||||
{
|
||||
// fix for known WinXP bug
|
||||
if (LOWORD(wParam) == SB_LINEUP)
|
||||
{
|
||||
ListView_Scroll(piano_roll.hwndList, 0, -piano_roll.list_row_height);
|
||||
return 0;
|
||||
} else if (LOWORD(wParam) == SB_LINEDOWN)
|
||||
{
|
||||
ListView_Scroll(piano_roll.hwndList, 0, piano_roll.list_row_height);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_HSCROLL:
|
||||
{
|
||||
if (LOWORD(wParam) == SB_LINELEFT)
|
||||
{
|
||||
ListView_Scroll(piano_roll.hwndList, -COLUMN_BUTTON_WIDTH, 0);
|
||||
return 0;
|
||||
} else if (LOWORD(wParam) == SB_LINERIGHT)
|
||||
{
|
||||
ListView_Scroll(piano_roll.hwndList, COLUMN_BUTTON_WIDTH, 0);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return CallWindowProc(hwndList_oldWndProc, hWnd, msg, wParam, lParam);
|
||||
|
|
|
@ -17,11 +17,15 @@
|
|||
#define HEADER_LIGHT_UPDATE_TICK 40 // 25FPS
|
||||
#define HEADER_DX_FIX 4
|
||||
|
||||
#define PIANO_ROLL_SCROLLING_BOOST 2
|
||||
#define BOOST_WHEN_BOTH_RIGHTBUTTON_AND_ALT_PRESSED 4
|
||||
|
||||
#define MARKER_DRAG_BOX_ALPHA 175
|
||||
#define DRAWING_MIN_LINE_LEN 14 // = min(list_row_width, list_row_height) in pixels
|
||||
|
||||
#define SCROLLING_BORDER_SIZE 8 // in pixels
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
COLUMN_ICONS,
|
||||
|
@ -176,8 +180,9 @@ public:
|
|||
HWND hwndList, hwndHeader;
|
||||
TRACKMOUSEEVENT tme;
|
||||
|
||||
int list_row_top, list_row_height, list_header_height;
|
||||
unsigned int drag_mode;
|
||||
int list_row_top, list_row_height;
|
||||
bool rbutton_drag_mode;
|
||||
int marker_drag_box_dx, marker_drag_box_dy;
|
||||
int marker_drag_framenum;
|
||||
int drawing_last_x, drawing_last_y;
|
||||
|
|
|
@ -207,9 +207,8 @@ void PLAYBACK::update()
|
|||
bookmarks.RedrawChangedBookmarks(currFrameCounter);
|
||||
lastCursor = currFrameCounter;
|
||||
piano_roll.FollowPlaybackIfNeeded();
|
||||
if (!turbo)
|
||||
// enforce redrawing now
|
||||
UpdateWindow(piano_roll.hwndList);
|
||||
// enforce redrawing now
|
||||
UpdateWindow(piano_roll.hwndList);
|
||||
// lazy update of "Playback's Marker text"
|
||||
int current_marker = markers_manager.GetMarkerUp(currFrameCounter);
|
||||
if (shown_marker != current_marker)
|
||||
|
|
|
@ -24,18 +24,19 @@ extern TASEDITOR_WINDOW taseditor_window;
|
|||
extern BOOKMARKS bookmarks;
|
||||
extern PIANO_ROLL piano_roll;
|
||||
extern MARKERS_MANAGER markers_manager;
|
||||
extern PLAYBACK playback;
|
||||
|
||||
LRESULT CALLBACK ScrBmpWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT APIENTRY MarkerNoteDescrWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
// resources
|
||||
char szClassName[] = "ScrBmp";
|
||||
char szClassName2[] = "MarketNoteTooltip";
|
||||
char szClassName2[] = "MarketNoteDescr";
|
||||
|
||||
POPUP_DISPLAY::POPUP_DISPLAY()
|
||||
{
|
||||
hwndScrBmp = 0;
|
||||
hwndMarkerNoteTooltip = 0;
|
||||
hwndMarkerNoteDescr = 0;
|
||||
// create BITMAPINFO
|
||||
scr_bmi = (LPBITMAPINFO)malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); // 256 color in palette
|
||||
scr_bmi->bmiHeader.biSize = sizeof(scr_bmi->bmiHeader);
|
||||
|
@ -119,10 +120,10 @@ void POPUP_DISPLAY::reset()
|
|||
DestroyWindow(hwndScrBmp);
|
||||
hwndScrBmp = 0;
|
||||
}
|
||||
if (hwndMarkerNoteTooltip)
|
||||
if (hwndMarkerNoteDescr)
|
||||
{
|
||||
DestroyWindow(hwndMarkerNoteTooltip);
|
||||
hwndMarkerNoteTooltip = 0;
|
||||
DestroyWindow(hwndMarkerNoteDescr);
|
||||
hwndMarkerNoteDescr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,19 +142,22 @@ void POPUP_DISPLAY::update()
|
|||
RedrawScreenshotBitmap();
|
||||
ShowWindow(hwndScrBmp, SW_SHOWNA);
|
||||
}
|
||||
if (taseditor_config.show_branch_descr && !hwndMarkerNoteTooltip)
|
||||
if (taseditor_config.show_branch_descr && !hwndMarkerNoteDescr)
|
||||
{
|
||||
hwndMarkerNoteTooltip = CreateWindowEx(WS_EX_LAYERED | WS_EX_TRANSPARENT, szClassName2, szClassName2, WS_POPUP, taseditor_config.wndx + tooltip_x, taseditor_config.wndy + tooltip_y, MARKER_NOTE_TOOLTIP_WIDTH, MARKER_NOTE_TOOLTIP_HEIGHT, taseditor_window.hwndTasEditor, NULL, fceu_hInstance, NULL);
|
||||
ChangeTooltipText();
|
||||
ShowWindow(hwndMarkerNoteTooltip, SW_SHOWNA);
|
||||
RECT wrect;
|
||||
GetWindowRect(playback.hwndPlaybackMarkerEdit, &wrect);
|
||||
descr_x = scr_bmp_x + (SCREENSHOT_WIDTH - (wrect.right - wrect.left)) / 2;
|
||||
hwndMarkerNoteDescr = CreateWindowEx(WS_EX_LAYERED | WS_EX_TRANSPARENT, szClassName2, szClassName2, WS_POPUP, taseditor_config.wndx + descr_x, taseditor_config.wndy + descr_y, wrect.right - wrect.left, wrect.bottom - wrect.top, taseditor_window.hwndTasEditor, NULL, fceu_hInstance, NULL);
|
||||
ChangeDescrText();
|
||||
ShowWindow(hwndMarkerNoteDescr, SW_SHOWNA);
|
||||
}
|
||||
// change screenshot_bitmap pic and tooltip text if needed
|
||||
// change screenshot_bitmap pic and description text if needed
|
||||
if (screenshot_currently_shown != bookmarks.item_under_mouse)
|
||||
{
|
||||
if (taseditor_config.show_branch_screenshots)
|
||||
ChangeScreenshotBitmap();
|
||||
if (taseditor_config.show_branch_descr)
|
||||
ChangeTooltipText();
|
||||
ChangeDescrText();
|
||||
screenshot_currently_shown = bookmarks.item_under_mouse;
|
||||
}
|
||||
if (scr_bmp_phase < SCR_BMP_PHASE_MAX)
|
||||
|
@ -167,10 +171,10 @@ void POPUP_DISPLAY::update()
|
|||
SetLayeredWindowAttributes(hwndScrBmp, 0, (255 * phase_alpha) / SCR_BMP_PHASE_ALPHA_MAX, LWA_ALPHA);
|
||||
UpdateLayeredWindow(hwndScrBmp, 0, 0, 0, 0, 0, 0, &blend, ULW_ALPHA);
|
||||
}
|
||||
if (hwndMarkerNoteTooltip)
|
||||
if (hwndMarkerNoteDescr)
|
||||
{
|
||||
SetLayeredWindowAttributes(hwndMarkerNoteTooltip, 0, (255 * phase_alpha) / SCR_BMP_PHASE_ALPHA_MAX, LWA_ALPHA);
|
||||
UpdateLayeredWindow(hwndMarkerNoteTooltip, 0, 0, 0, 0, 0, 0, &blend, ULW_ALPHA);
|
||||
SetLayeredWindowAttributes(hwndMarkerNoteDescr, 0, (255 * phase_alpha) / SCR_BMP_PHASE_ALPHA_MAX, LWA_ALPHA);
|
||||
UpdateLayeredWindow(hwndMarkerNoteDescr, 0, 0, 0, 0, 0, 0, &blend, ULW_ALPHA);
|
||||
}
|
||||
}
|
||||
} else
|
||||
|
@ -188,10 +192,10 @@ void POPUP_DISPLAY::update()
|
|||
SetLayeredWindowAttributes(hwndScrBmp, 0, (255 * phase_alpha) / SCR_BMP_PHASE_ALPHA_MAX, LWA_ALPHA);
|
||||
UpdateLayeredWindow(hwndScrBmp, 0, 0, 0, 0, 0, 0, &blend, ULW_ALPHA);
|
||||
}
|
||||
if (hwndMarkerNoteTooltip)
|
||||
if (hwndMarkerNoteDescr)
|
||||
{
|
||||
SetLayeredWindowAttributes(hwndMarkerNoteTooltip, 0, (255 * phase_alpha) / SCR_BMP_PHASE_ALPHA_MAX, LWA_ALPHA);
|
||||
UpdateLayeredWindow(hwndMarkerNoteTooltip, 0, 0, 0, 0, 0, 0, &blend, ULW_ALPHA);
|
||||
SetLayeredWindowAttributes(hwndMarkerNoteDescr, 0, (255 * phase_alpha) / SCR_BMP_PHASE_ALPHA_MAX, LWA_ALPHA);
|
||||
UpdateLayeredWindow(hwndMarkerNoteDescr, 0, 0, 0, 0, 0, 0, &blend, ULW_ALPHA);
|
||||
}
|
||||
} else
|
||||
{
|
||||
|
@ -202,10 +206,10 @@ void POPUP_DISPLAY::update()
|
|||
DestroyWindow(hwndScrBmp);
|
||||
hwndScrBmp = 0;
|
||||
}
|
||||
if (hwndMarkerNoteTooltip)
|
||||
if (hwndMarkerNoteDescr)
|
||||
{
|
||||
DestroyWindow(hwndMarkerNoteTooltip);
|
||||
hwndMarkerNoteTooltip = 0;
|
||||
DestroyWindow(hwndMarkerNoteDescr);
|
||||
hwndMarkerNoteDescr = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -232,14 +236,14 @@ void POPUP_DISPLAY::RedrawScreenshotBitmap()
|
|||
if (temp_bmp && temp_bmp != scr_bmp)
|
||||
DeleteObject(temp_bmp);
|
||||
}
|
||||
void POPUP_DISPLAY::ChangeTooltipText()
|
||||
void POPUP_DISPLAY::ChangeDescrText()
|
||||
{
|
||||
// retrieve info from the pointed bookmark's markers
|
||||
int frame = bookmarks.bookmarks_array[bookmarks.item_under_mouse].snapshot.jump_frame;
|
||||
int marker_id = markers_manager.GetMarkerUp(bookmarks.bookmarks_array[bookmarks.item_under_mouse].snapshot.GetMarkers(), frame);
|
||||
char new_text[MAX_NOTE_LEN];
|
||||
strcpy(new_text, markers_manager.GetNote(bookmarks.bookmarks_array[bookmarks.item_under_mouse].snapshot.GetMarkers(), marker_id).c_str());
|
||||
SetWindowText(marker_note_tooltip, new_text);
|
||||
SetWindowText(marker_note_descr, new_text);
|
||||
}
|
||||
|
||||
void POPUP_DISPLAY::ParentWindowMoved()
|
||||
|
@ -250,13 +254,15 @@ void POPUP_DISPLAY::ParentWindowMoved()
|
|||
GetWindowRect(GetDlgItem(taseditor_window.hwndTasEditor, IDC_BOOKMARKS_BOX), &temp_rect);
|
||||
scr_bmp_x = temp_rect.left - SCREENSHOT_WIDTH - SCR_BMP_DX - parent_rect.left;
|
||||
scr_bmp_y = (temp_rect.bottom - SCREENSHOT_HEIGHT) - parent_rect.top;
|
||||
tooltip_x = scr_bmp_x + (SCREENSHOT_WIDTH - MARKER_NOTE_TOOLTIP_WIDTH) / 2;
|
||||
tooltip_y = scr_bmp_y + SCREENSHOT_HEIGHT + SCR_BMP_TOOLTIP_GAP;
|
||||
RECT wrect;
|
||||
GetWindowRect(playback.hwndPlaybackMarkerEdit, &wrect);
|
||||
descr_x = scr_bmp_x + (SCREENSHOT_WIDTH - (wrect.right - wrect.left)) / 2;
|
||||
descr_y = scr_bmp_y + SCREENSHOT_HEIGHT + SCR_BMP_DESCR_GAP;
|
||||
// if popup windows are currently shown, update their positions
|
||||
if (hwndScrBmp)
|
||||
SetWindowPos(hwndScrBmp, 0, taseditor_config.wndx + scr_bmp_x, taseditor_config.wndy + scr_bmp_y, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
if (hwndMarkerNoteTooltip)
|
||||
SetWindowPos(hwndMarkerNoteTooltip, 0, taseditor_config.wndx + tooltip_x, taseditor_config.wndy + tooltip_y, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
if (hwndMarkerNoteDescr)
|
||||
SetWindowPos(hwndMarkerNoteDescr, 0, taseditor_config.wndx + descr_x, taseditor_config.wndy + descr_y, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
}
|
||||
// ----------------------------------------------------------------------------------------
|
||||
LRESULT APIENTRY ScrBmpWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
@ -282,8 +288,10 @@ LRESULT APIENTRY MarkerNoteDescrWndProc(HWND hwnd, UINT message, WPARAM wParam,
|
|||
case WM_CREATE:
|
||||
{
|
||||
// create static text field
|
||||
popup_display.marker_note_tooltip = CreateWindow(WC_STATIC, NULL, WS_CHILD | WS_VISIBLE | SS_CENTER | SS_SUNKEN, 1, 1, MARKER_NOTE_TOOLTIP_WIDTH - 2, MARKER_NOTE_TOOLTIP_HEIGHT - 2, hwnd, NULL, NULL, NULL);
|
||||
SendMessage(popup_display.marker_note_tooltip, WM_SETFONT, (WPARAM)piano_roll.hMarkersEditFont, 0);
|
||||
RECT wrect;
|
||||
GetWindowRect(playback.hwndPlaybackMarkerEdit, &wrect);
|
||||
popup_display.marker_note_descr = CreateWindow(WC_STATIC, NULL, WS_CHILD | WS_VISIBLE | SS_CENTER | SS_ENDELLIPSIS | SS_SUNKEN, 1, 1, wrect.right - wrect.left - 2, wrect.bottom - wrect.top - 2, hwnd, NULL, NULL, NULL);
|
||||
SendMessage(popup_display.marker_note_descr, WM_SETFONT, (WPARAM)piano_roll.hMarkersEditFont, 0);
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
#define SCR_BMP_PHASE_ALPHA_MAX 8
|
||||
#define SCR_BMP_DX 7
|
||||
|
||||
#define SCR_BMP_TOOLTIP_GAP 2
|
||||
|
||||
#define MARKER_NOTE_TOOLTIP_WIDTH 360
|
||||
#define MARKER_NOTE_TOOLTIP_HEIGHT 20
|
||||
#define SCR_BMP_DESCR_GAP 2
|
||||
|
||||
#define DISPLAY_UPDATE_TICK 40 // update at 25FPS
|
||||
|
||||
|
@ -22,12 +19,12 @@ public:
|
|||
|
||||
void ChangeScreenshotBitmap();
|
||||
void RedrawScreenshotBitmap();
|
||||
void ChangeTooltipText();
|
||||
void ChangeDescrText();
|
||||
|
||||
void ParentWindowMoved();
|
||||
|
||||
int screenshot_currently_shown;
|
||||
HWND hwndScrBmp, scr_bmp_pic, hwndMarkerNoteTooltip, marker_note_tooltip;
|
||||
HWND hwndScrBmp, scr_bmp_pic, hwndMarkerNoteDescr, marker_note_descr;
|
||||
|
||||
private:
|
||||
int scr_bmp_x;
|
||||
|
@ -35,8 +32,8 @@ private:
|
|||
int scr_bmp_phase;
|
||||
int next_update_time;
|
||||
|
||||
int tooltip_x;
|
||||
int tooltip_y;
|
||||
int descr_x;
|
||||
int descr_y;
|
||||
|
||||
WNDCLASSEX wincl1, wincl2;
|
||||
BLENDFUNCTION blend;
|
||||
|
|
|
@ -1330,7 +1330,6 @@ BOOL CALLBACK WndprocTasEditor(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
&& y > window_items[PIANOROLL_IN_WINDOWITEMS].y
|
||||
&& y < window_items[PIANOROLL_IN_WINDOWITEMS].y + (wrect.bottom - wrect.top))
|
||||
{
|
||||
piano_roll.DragPlaybackCursor();
|
||||
if (piano_roll.drag_mode == DRAG_MODE_NONE)
|
||||
piano_roll.drag_mode = DRAG_MODE_PLAYBACK;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue