Taseditor: minor fixes
This commit is contained in:
parent
4f4805760b
commit
d188a2def2
|
@ -652,13 +652,14 @@ void BOOKMARKS::RightClick()
|
||||||
|
|
||||||
int BOOKMARKS::FindBookmarkAtFrame(int frame)
|
int BOOKMARKS::FindBookmarkAtFrame(int frame)
|
||||||
{
|
{
|
||||||
int current_branch = branches.GetCurrentBranch();
|
int cur_bookmark = branches.GetCurrentBranch();
|
||||||
if (current_branch >= 0 && bookmarks_array[current_branch].snapshot.jump_frame == frame)
|
if (cur_bookmark >= 0 && bookmarks_array[cur_bookmark].snapshot.jump_frame == frame)
|
||||||
return current_branch + TOTAL_BOOKMARKS; // blue digit has highest priority when drawing
|
return cur_bookmark + TOTAL_BOOKMARKS; // blue digit has highest priority when drawing
|
||||||
for (int i = 0; i < TOTAL_BOOKMARKS; ++i)
|
for (int i = 0; i < TOTAL_BOOKMARKS; ++i)
|
||||||
{
|
{
|
||||||
if (bookmarks_array[i].not_empty && bookmarks_array[i].snapshot.jump_frame == frame)
|
cur_bookmark = (i + 1) % TOTAL_BOOKMARKS;
|
||||||
return i; // green digit
|
if (bookmarks_array[cur_bookmark].not_empty && bookmarks_array[cur_bookmark].snapshot.jump_frame == frame)
|
||||||
|
return cur_bookmark; // green digit
|
||||||
}
|
}
|
||||||
return -1; // no Bookmarks at the frame
|
return -1; // no Bookmarks at the frame
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,12 +70,32 @@ void BRANCHES::init()
|
||||||
// init GDI stuff
|
// init GDI stuff
|
||||||
HDC win_hdc = GetWindowDC(bookmarks.hwndBranchesBitmap);
|
HDC win_hdc = GetWindowDC(bookmarks.hwndBranchesBitmap);
|
||||||
hBitmapDC = CreateCompatibleDC(win_hdc);
|
hBitmapDC = CreateCompatibleDC(win_hdc);
|
||||||
branches_hbitmap = CreateCompatibleBitmap(win_hdc, BRANCHES_BITMAP_WIDTH, BRANCHES_BITMAP_WIDTH);
|
branches_hbitmap = CreateCompatibleBitmap(win_hdc, BRANCHES_BITMAP_WIDTH, BRANCHES_BITMAP_HEIGHT);
|
||||||
hOldBitmap = (HBITMAP)SelectObject(hBitmapDC, branches_hbitmap);
|
hOldBitmap = (HBITMAP)SelectObject(hBitmapDC, branches_hbitmap);
|
||||||
hBufferDC = CreateCompatibleDC(win_hdc);
|
hBufferDC = CreateCompatibleDC(win_hdc);
|
||||||
buffer_hbitmap = CreateCompatibleBitmap(win_hdc, BRANCHES_BITMAP_WIDTH, BRANCHES_BITMAP_WIDTH);
|
buffer_hbitmap = CreateCompatibleBitmap(win_hdc, BRANCHES_BITMAP_WIDTH, BRANCHES_BITMAP_HEIGHT);
|
||||||
hOldBitmap1 = (HBITMAP)SelectObject(hBufferDC, buffer_hbitmap);
|
hOldBitmap1 = (HBITMAP)SelectObject(hBufferDC, buffer_hbitmap);
|
||||||
normal_brush = CreateSolidBrush(0x000000);
|
normal_brush = CreateSolidBrush(0x000000);
|
||||||
|
border_brush = CreateSolidBrush(0xb99d7f);
|
||||||
|
// prepare bg gradient
|
||||||
|
vertex[0].x = 0;
|
||||||
|
vertex[0].y = 0;
|
||||||
|
vertex[0].Red = 0xBF00;
|
||||||
|
vertex[0].Green = 0xE200;
|
||||||
|
vertex[0].Blue = 0xEF00;
|
||||||
|
vertex[0].Alpha = 0x0000;
|
||||||
|
vertex[1].x = BRANCHES_BITMAP_WIDTH;
|
||||||
|
vertex[1].y = BRANCHES_BITMAP_HEIGHT;
|
||||||
|
vertex[1].Red = 0xE500;
|
||||||
|
vertex[1].Green = 0xFB00;
|
||||||
|
vertex[1].Blue = 0xFF00;
|
||||||
|
vertex[1].Alpha = 0x0000;
|
||||||
|
gRect.UpperLeft = 0;
|
||||||
|
gRect.LowerRight = 1;
|
||||||
|
branches_bitmap_rect.left = 0;
|
||||||
|
branches_bitmap_rect.top = 0;
|
||||||
|
branches_bitmap_rect.right = BRANCHES_BITMAP_WIDTH;
|
||||||
|
branches_bitmap_rect.bottom = BRANCHES_BITMAP_HEIGHT;
|
||||||
// prepare branches spritesheet
|
// prepare branches spritesheet
|
||||||
branchesSpritesheet = LoadBitmap(fceu_hInstance, MAKEINTRESOURCE(IDB_BRANCH_SPRITESHEET));
|
branchesSpritesheet = LoadBitmap(fceu_hInstance, MAKEINTRESOURCE(IDB_BRANCH_SPRITESHEET));
|
||||||
hSpritesheetDC = CreateCompatibleDC(win_hdc);
|
hSpritesheetDC = CreateCompatibleDC(win_hdc);
|
||||||
|
@ -142,6 +162,16 @@ void BRANCHES::free()
|
||||||
DeleteObject(branchesSpritesheet);
|
DeleteObject(branchesSpritesheet);
|
||||||
branchesSpritesheet = NULL;
|
branchesSpritesheet = NULL;
|
||||||
}
|
}
|
||||||
|
if (normal_brush)
|
||||||
|
{
|
||||||
|
DeleteObject(normal_brush);
|
||||||
|
normal_brush = 0;
|
||||||
|
}
|
||||||
|
if (border_brush)
|
||||||
|
{
|
||||||
|
DeleteObject(border_brush);
|
||||||
|
border_brush = 0;
|
||||||
|
}
|
||||||
if (normal_pen)
|
if (normal_pen)
|
||||||
{
|
{
|
||||||
DeleteObject(normal_pen);
|
DeleteObject(normal_pen);
|
||||||
|
@ -417,25 +447,8 @@ error:
|
||||||
// ----------------------------------------------------------
|
// ----------------------------------------------------------
|
||||||
void BRANCHES::RedrawBranchesTree()
|
void BRANCHES::RedrawBranchesTree()
|
||||||
{
|
{
|
||||||
// draw background gradient
|
// draw background
|
||||||
TRIVERTEX vertex[2] ;
|
|
||||||
vertex[0].x = 0;
|
|
||||||
vertex[0].y = 0;
|
|
||||||
vertex[0].Red = 0xC700;
|
|
||||||
vertex[0].Green = 0xE700;
|
|
||||||
vertex[0].Blue = 0xF300;
|
|
||||||
vertex[0].Alpha = 0x0000;
|
|
||||||
vertex[1].x = BRANCHES_BITMAP_WIDTH;
|
|
||||||
vertex[1].y = BRANCHES_BITMAP_HEIGHT;
|
|
||||||
vertex[1].Red = 0xEB00;
|
|
||||||
vertex[1].Green = 0xFA00;
|
|
||||||
vertex[1].Blue = 0xF800;
|
|
||||||
vertex[1].Alpha = 0x0000;
|
|
||||||
GRADIENT_RECT gRect;
|
|
||||||
gRect.UpperLeft = 0;
|
|
||||||
gRect.LowerRight = 1;
|
|
||||||
GradientFill(hBitmapDC, vertex, 2, &gRect, 1, GRADIENT_FILL_RECT_H);
|
GradientFill(hBitmapDC, vertex, 2, &gRect, 1, GRADIENT_FILL_RECT_H);
|
||||||
|
|
||||||
// lines
|
// lines
|
||||||
int branch, branch_x, branch_y, parent_x, parent_y, child_id;
|
int branch, branch_x, branch_y, parent_x, parent_y, child_id;
|
||||||
SelectObject(hBitmapDC, normal_pen);
|
SelectObject(hBitmapDC, normal_pen);
|
||||||
|
@ -535,10 +548,8 @@ void BRANCHES::RedrawBranchesTree()
|
||||||
branch_y = BranchCurrY[TOTAL_BOOKMARKS];
|
branch_y = BranchCurrY[TOTAL_BOOKMARKS];
|
||||||
LineTo(hBitmapDC, branch_x, branch_y);
|
LineTo(hBitmapDC, branch_x, branch_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// cloud
|
// cloud
|
||||||
TransparentBlt(hBitmapDC, cloud_x - BRANCHES_CLOUD_HALFWIDTH, BRANCHES_CLOUD_Y - BRANCHES_CLOUD_HALFHEIGHT, BRANCHES_CLOUD_WIDTH, BRANCHES_CLOUD_HEIGHT, hSpritesheetDC, BRANCHES_CLOUD_SPRITESHEET_X, BRANCHES_CLOUD_SPRITESHEET_Y, BRANCHES_CLOUD_WIDTH, BRANCHES_CLOUD_HEIGHT, 0x00FF00);
|
TransparentBlt(hBitmapDC, cloud_x - BRANCHES_CLOUD_HALFWIDTH, BRANCHES_CLOUD_Y - BRANCHES_CLOUD_HALFHEIGHT, BRANCHES_CLOUD_WIDTH, BRANCHES_CLOUD_HEIGHT, hSpritesheetDC, BRANCHES_CLOUD_SPRITESHEET_X, BRANCHES_CLOUD_SPRITESHEET_Y, BRANCHES_CLOUD_WIDTH, BRANCHES_CLOUD_HEIGHT, 0x00FF00);
|
||||||
|
|
||||||
// branches rectangles
|
// branches rectangles
|
||||||
for (int i = 0; i < TOTAL_BOOKMARKS; ++i)
|
for (int i = 0; i < TOTAL_BOOKMARKS; ++i)
|
||||||
{
|
{
|
||||||
|
@ -555,12 +566,12 @@ void BRANCHES::RedrawBranchesTree()
|
||||||
{
|
{
|
||||||
// draw colored rect
|
// draw colored rect
|
||||||
HBRUSH color_brush = CreateSolidBrush(bookmark_flash_colors[bookmarks.bookmarks_array[i].flash_type][bookmarks.bookmarks_array[i].flash_phase]);
|
HBRUSH color_brush = CreateSolidBrush(bookmark_flash_colors[bookmarks.bookmarks_array[i].flash_type][bookmarks.bookmarks_array[i].flash_phase]);
|
||||||
FillRect(hBitmapDC, &temp_rect, color_brush);
|
FrameRect(hBitmapDC, &temp_rect, color_brush);
|
||||||
DeleteObject(color_brush);
|
DeleteObject(color_brush);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// draw black rect
|
// draw black rect
|
||||||
FillRect(hBitmapDC, &temp_rect, normal_brush);
|
FrameRect(hBitmapDC, &temp_rect, normal_brush);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// digits
|
// digits
|
||||||
|
@ -625,6 +636,8 @@ void BRANCHES::RedrawBranchesTree()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// draw border of canvas
|
||||||
|
FrameRect(hBitmapDC, &branches_bitmap_rect, border_brush);
|
||||||
// finished
|
// finished
|
||||||
must_redraw_branches_tree = false;
|
must_redraw_branches_tree = false;
|
||||||
InvalidateRect(bookmarks.hwndBranchesBitmap, 0, FALSE);
|
InvalidateRect(bookmarks.hwndBranchesBitmap, 0, FALSE);
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#define BASE_HORIZONTAL_SHIFT 10
|
#define BASE_HORIZONTAL_SHIFT 10
|
||||||
#define BRANCHES_GRID_MIN_HALFHEIGHT 8
|
#define BRANCHES_GRID_MIN_HALFHEIGHT 8
|
||||||
#define BRANCHES_GRID_MAX_HALFHEIGHT 12
|
#define BRANCHES_GRID_MAX_HALFHEIGHT 12
|
||||||
#define EMPTY_BRANCHES_X_BASE 3
|
#define EMPTY_BRANCHES_X_BASE 4
|
||||||
#define EMPTY_BRANCHES_Y_BASE 9
|
#define EMPTY_BRANCHES_Y_BASE 9
|
||||||
#define EMPTY_BRANCHES_Y_FACTOR 14
|
#define EMPTY_BRANCHES_Y_FACTOR 14
|
||||||
#define MAX_NUM_CHILDREN_ON_CANVAS_HEIGHT 9
|
#define MAX_NUM_CHILDREN_ON_CANVAS_HEIGHT 9
|
||||||
|
@ -160,11 +160,14 @@ private:
|
||||||
int latest_drawn_item_under_mouse;
|
int latest_drawn_item_under_mouse;
|
||||||
|
|
||||||
// GDI stuff
|
// GDI stuff
|
||||||
HBRUSH normal_brush;
|
HBRUSH normal_brush, border_brush;
|
||||||
RECT temp_rect;
|
RECT temp_rect;
|
||||||
HPEN normal_pen, timeline_pen, select_pen;
|
HPEN normal_pen, timeline_pen, select_pen;
|
||||||
HBITMAP branches_hbitmap, hOldBitmap, buffer_hbitmap, hOldBitmap1, branchesSpritesheet, hOldBitmap2;
|
HBITMAP branches_hbitmap, hOldBitmap, buffer_hbitmap, hOldBitmap1, branchesSpritesheet, hOldBitmap2;
|
||||||
HDC hBitmapDC, hBufferDC, hSpritesheetDC;
|
HDC hBitmapDC, hBufferDC, hSpritesheetDC;
|
||||||
|
TRIVERTEX vertex[2];
|
||||||
|
GRADIENT_RECT gRect;
|
||||||
|
RECT branches_bitmap_rect;
|
||||||
|
|
||||||
// temps
|
// temps
|
||||||
std::vector<int> GridX; // in grid units
|
std::vector<int> GridX; // in grid units
|
||||||
|
|
|
@ -1593,15 +1593,9 @@ LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
// clicked without Shift/Alt - set "row_last_clicked" here
|
// clicked without Shift/Alt - set "row_last_clicked" here
|
||||||
piano_roll.row_last_clicked = row_index;
|
piano_roll.row_last_clicked = row_index;
|
||||||
// and change Selection to this row
|
if (!(fwKeys & MK_CONTROL))
|
||||||
if (fwKeys & MK_CONTROL)
|
|
||||||
{
|
|
||||||
if (selection.GetRowSelection(row_index))
|
|
||||||
selection.ClearRowSelection(row_index);
|
|
||||||
else
|
|
||||||
selection.SetRowSelection(row_index);
|
|
||||||
} else
|
|
||||||
{
|
{
|
||||||
|
// change Selection to this row
|
||||||
selection.ClearSelection();
|
selection.ClearSelection();
|
||||||
selection.SetRowSelection(row_index);
|
selection.SetRowSelection(row_index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1003,8 +1003,6 @@ BOOL CALLBACK WndprocTasEditor(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
splicer.InsertFrames();
|
splicer.InsertFrames();
|
||||||
break;
|
break;
|
||||||
case ACCEL_DEL:
|
case ACCEL_DEL:
|
||||||
case ID_EDIT_CLEAR:
|
|
||||||
case ID_CONTEXT_SELECTED_CLEARFRAMES:
|
|
||||||
if (markers_manager.marker_note_edit == MARKER_NOTE_EDIT_UPPER)
|
if (markers_manager.marker_note_edit == MARKER_NOTE_EDIT_UPPER)
|
||||||
{
|
{
|
||||||
DWORD sel_start, sel_end;
|
DWORD sel_start, sel_end;
|
||||||
|
@ -1022,6 +1020,10 @@ BOOL CALLBACK WndprocTasEditor(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
} else
|
} else
|
||||||
splicer.ClearFrames();
|
splicer.ClearFrames();
|
||||||
break;
|
break;
|
||||||
|
case ID_EDIT_CLEAR:
|
||||||
|
case ID_CONTEXT_SELECTED_CLEARFRAMES:
|
||||||
|
splicer.ClearFrames();
|
||||||
|
break;
|
||||||
case CHECK_FOLLOW_CURSOR:
|
case CHECK_FOLLOW_CURSOR:
|
||||||
taseditor_config.follow_playback ^= 1;
|
taseditor_config.follow_playback ^= 1;
|
||||||
taseditor_window.UpdateCheckedItems();
|
taseditor_window.UpdateCheckedItems();
|
||||||
|
@ -1180,14 +1182,6 @@ BOOL CALLBACK WndprocTasEditor(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
taseditor_config.autopause_at_finish ^= 1;
|
taseditor_config.autopause_at_finish ^= 1;
|
||||||
taseditor_window.UpdateCheckedItems();
|
taseditor_window.UpdateCheckedItems();
|
||||||
break;
|
break;
|
||||||
case IDC_PROGRESS_BUTTON:
|
|
||||||
playback.CancelSeeking();
|
|
||||||
break;
|
|
||||||
case IDC_BRANCHES_BUTTON:
|
|
||||||
// click on "Bookmarks/Branches" - switch between Bookmarks List and Branches Tree
|
|
||||||
taseditor_config.view_branches_tree ^= 1;
|
|
||||||
bookmarks.RedrawBookmarksCaption();
|
|
||||||
break;
|
|
||||||
case IDC_RECORDING:
|
case IDC_RECORDING:
|
||||||
FCEUI_MovieToggleReadOnly();
|
FCEUI_MovieToggleReadOnly();
|
||||||
CheckDlgButton(taseditor_window.hwndTasEditor, IDC_RECORDING, movie_readonly?BST_UNCHECKED : BST_CHECKED);
|
CheckDlgButton(taseditor_window.hwndTasEditor, IDC_RECORDING, movie_readonly?BST_UNCHECKED : BST_CHECKED);
|
||||||
|
@ -1340,13 +1334,33 @@ BOOL CALLBACK WndprocTasEditor(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
DialogBox(fceu_hInstance, MAKEINTRESOURCE(IDD_TASEDITOR_ABOUT), taseditor_window.hwndTasEditor, AboutProc);
|
DialogBox(fceu_hInstance, MAKEINTRESOURCE(IDD_TASEDITOR_ABOUT), taseditor_window.hwndTasEditor, AboutProc);
|
||||||
break;
|
break;
|
||||||
case ACCEL_HOME:
|
case ACCEL_HOME:
|
||||||
|
{
|
||||||
|
if (markers_manager.marker_note_edit == MARKER_NOTE_EDIT_UPPER)
|
||||||
|
SendMessage(playback.hwndPlaybackMarkerEdit, EM_SETSEL, 0, 0);
|
||||||
|
else if (markers_manager.marker_note_edit == MARKER_NOTE_EDIT_LOWER)
|
||||||
|
SendMessage(selection.hwndSelectionMarkerEdit, EM_SETSEL, 0, 0);
|
||||||
|
else
|
||||||
// scroll Piano Roll to the beginning
|
// scroll Piano Roll to the beginning
|
||||||
ListView_Scroll(piano_roll.hwndList, 0, -piano_roll.list_row_height * ListView_GetTopIndex(piano_roll.hwndList));
|
ListView_Scroll(piano_roll.hwndList, 0, -piano_roll.list_row_height * ListView_GetTopIndex(piano_roll.hwndList));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case ACCEL_END:
|
case ACCEL_END:
|
||||||
|
{
|
||||||
|
if (markers_manager.marker_note_edit == MARKER_NOTE_EDIT_UPPER)
|
||||||
|
{
|
||||||
|
SendMessage(playback.hwndPlaybackMarkerEdit, EM_SETSEL, 0, -1);
|
||||||
|
SendMessage(playback.hwndPlaybackMarkerEdit, EM_SETSEL, -1, -1);
|
||||||
|
} else if (markers_manager.marker_note_edit == MARKER_NOTE_EDIT_LOWER)
|
||||||
|
{
|
||||||
|
SendMessage(selection.hwndSelectionMarkerEdit, EM_SETSEL, 0, -1);
|
||||||
|
SendMessage(selection.hwndSelectionMarkerEdit, EM_SETSEL, -1, -1);
|
||||||
|
} else
|
||||||
|
{
|
||||||
// scroll Piano Roll to the end
|
// scroll Piano Roll to the end
|
||||||
ListView_Scroll(piano_roll.hwndList, 0, piano_roll.list_row_height * currMovieData.getNumRecords());
|
ListView_Scroll(piano_roll.hwndList, 0, piano_roll.list_row_height * currMovieData.getNumRecords());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case ACCEL_PGUP:
|
case ACCEL_PGUP:
|
||||||
// scroll Piano Roll 1 page up
|
// scroll Piano Roll 1 page up
|
||||||
ListView_Scroll(piano_roll.hwndList, 0, -piano_roll.list_row_height * ListView_GetCountPerPage(piano_roll.hwndList));
|
ListView_Scroll(piano_roll.hwndList, 0, -piano_roll.list_row_height * ListView_GetCountPerPage(piano_roll.hwndList));
|
||||||
|
@ -1531,6 +1545,10 @@ LRESULT APIENTRY IDC_PROGRESS_BUTTON_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
{
|
{
|
||||||
switch(msg)
|
switch(msg)
|
||||||
{
|
{
|
||||||
|
case WM_LBUTTONDOWN:
|
||||||
|
case WM_LBUTTONDBLCLK:
|
||||||
|
playback.CancelSeeking();
|
||||||
|
return 0;
|
||||||
case WM_MBUTTONDOWN:
|
case WM_MBUTTONDOWN:
|
||||||
case WM_MBUTTONDBLCLK:
|
case WM_MBUTTONDBLCLK:
|
||||||
playback.MiddleButtonClick();
|
playback.MiddleButtonClick();
|
||||||
|
@ -1544,6 +1562,12 @@ LRESULT APIENTRY IDC_BRANCHES_BUTTON_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
{
|
{
|
||||||
switch(msg)
|
switch(msg)
|
||||||
{
|
{
|
||||||
|
case WM_LBUTTONDOWN:
|
||||||
|
case WM_LBUTTONDBLCLK:
|
||||||
|
// click on "Bookmarks/Branches" - switch between Bookmarks List and Branches Tree
|
||||||
|
taseditor_config.view_branches_tree ^= 1;
|
||||||
|
bookmarks.RedrawBookmarksCaption();
|
||||||
|
return 0;
|
||||||
case WM_MBUTTONDOWN:
|
case WM_MBUTTONDOWN:
|
||||||
case WM_MBUTTONDBLCLK:
|
case WM_MBUTTONDBLCLK:
|
||||||
playback.MiddleButtonClick();
|
playback.MiddleButtonClick();
|
||||||
|
|
Loading…
Reference in New Issue