Changeset 1302
- Timestamp:
- 11/05/07 01:10:45 (10 months ago)
- Location:
- trunk/src/buzelib
- Files:
-
- 3 modified
-
MachineView.cpp (modified) (3 diffs)
-
MachineView.h (modified) (1 diff)
-
PatternEditor/PatternEditorInner.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/buzelib/MachineView.cpp
r1301 r1302 1159 1159 if (!machine) continue; 1160 1160 if (machine->nonSongPlugin) continue; 1161 RECT rc; 1162 getStatusRect(machine, &rc); 1163 InvalidateRect(&rc, FALSE); 1161 1162 std::map<zzub::metaplugin*, bool>::iterator ledState = ledStates.find(machine); 1163 1164 bool newState = machine->lastWorkState || machine->lastMidiState; 1165 1166 if (ledState == ledStates.end() || newState != ledState->second) { 1167 RECT rc; 1168 getStatusRect(machine, &rc); 1169 InvalidateRect(&rc, FALSE); 1170 } 1164 1171 } 1165 1172 } … … 1494 1501 getStatusRect(machine, &rc); 1495 1502 1496 MachineSkin* skin = mainFrame->getSkin(machine->loader->plugin_info->uri); 1497 if (skin && skin->led && !machine->minimized) { 1498 CDC bitmapDC; 1499 bitmapDC.CreateCompatibleDC(0); 1500 bitmapDC.SelectBitmap(skin->led); 1501 BITMAP bm; 1502 ::GetObject(skin->led, sizeof(bm), &bm); 1503 1504 if (machine->lastWorkState || machine->lastMidiState) { 1505 dc.StretchBlt(rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, bitmapDC, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); 1503 std::map<zzub::metaplugin*, bool>::iterator ledState = ledStates.find(machine); 1504 1505 bool newState = machine->lastWorkState || machine->lastMidiState; 1506 1507 if (dirtyMachines || ledState == ledStates.end() || newState != ledState->second) { 1508 1509 MachineSkin* skin = mainFrame->getSkin(machine->loader->plugin_info->uri); 1510 if (skin && skin->led && !machine->minimized) { 1511 CDC bitmapDC; 1512 bitmapDC.CreateCompatibleDC(0); 1513 bitmapDC.SelectBitmap(skin->led); 1514 BITMAP bm; 1515 ::GetObject(skin->led, sizeof(bm), &bm); 1516 1517 if (newState) { 1518 dc.StretchBlt(rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, bitmapDC, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); 1519 } else { 1520 // draw a rectangle from the machine skin where the led is drawn 1521 drawMachine(dc, machine, true); 1522 } 1506 1523 } else { 1507 // draw a rectangle from the machine skin where the led is drawn 1508 drawMachine(dc, machine, true); 1524 CBrushHandle prevBrush = dc.SelectBrush(getMachineLedBrush(machine)); 1525 dc.Rectangle(&rc); 1526 dc.SelectBrush(prevBrush); 1509 1527 } 1510 } else { 1511 CBrushHandle prevBrush = dc.SelectBrush(getMachineLedBrush(machine)); 1512 dc.Rectangle(&rc); 1513 dc.SelectBrush(prevBrush); 1528 1529 ledStates[machine] = newState; 1514 1530 } 1515 1531 … … 1649 1665 case UpdateNewDocument: 1650 1666 case UpdateOpenDocument: 1667 ledStates.clear(); 1651 1668 document->clearSelectedMachines(); 1652 1669 document->selectMachine(document->player->master); 1670 break; 1671 case UpdateDeleteMachine: 1672 ledStates.clear(); 1653 1673 break; 1654 1674 case UpdateMachines: -
trunk/src/buzelib/MachineView.h
r1298 r1302 69 69 bool dirtyOffscreenBitmap; 70 70 CBitmap offscreenBitmap; 71 72 std::map<zzub::metaplugin*, bool> ledStates; 73 71 74 public: 72 75 double scale; -
trunk/src/buzelib/PatternEditor/PatternEditorInner.cpp
r1287 r1302 103 103 dc.SetBkColor(colors[PE_BG]); 104 104 dc.SetTextColor(colors[PE_TextValue]); 105 dc.FillSolidRect(& rcClient, colors[PE_BG]);105 dc.FillSolidRect(&dc.m_rc, colors[PE_BG]); 106 106 107 107 int screenrows = rcClient.bottom / font_size.cy; 108 109 for (int i = 0; i <= screenrows && i+scroll.y < rows; i++) { 108 int cliprows = dc.m_rc.bottom / font_size.cy; 109 int firscliprow = dc.m_rc.top / font_size.cy; 110 111 for (int i = firscliprow; i <= cliprows && i+scroll.y < rows; i++) { 110 112 int src_y = (i + scroll.y) * font_size.cy; 111 113 int dest_y = i * font_size.cy; … … 189 191 bool CPatternEditorInner::GetRangeRectScreen(int from_col, int from_row, int to_col, int to_row, RECT* rc) { 190 192 if (from_col == -1) return false; 193 if (columns.size() == 0) return false; 191 194 192 195 int left_col = std::min(from_col, to_col); … … 356 359 357 360 if (mouse_mode == mouse_mode_drag) { 361 RECT rcPrevDrag; 362 int sel_width = select_end.x - select_start.x; 363 int sel_height = select_end.y - select_start.y; 364 if (!GetRangeRectScreen(drag_to.x, drag_to.y, drag_to.x + sel_width, drag_to.y + sel_height, &rcPrevDrag)) { 365 rcPrevDrag.left = -1; 366 } 367 358 368 int scroll_diff_y = (scroll.y - drag_scroll.y); 359 369 int scroll_diff_x = (scroll.x - drag_scroll.x); … … 373 383 374 384 GetParent().SendMessage(WM_COMMAND, MAKEWPARAM(ID_PATTERNEDITOR_SELDRAG, 0), 0); 375 Invalidate(FALSE); 385 386 // invalidate drag rect 387 RECT rcDrag; 388 389 if (!GetRangeRectScreen(drag_to.x, drag_to.y, drag_to.x + sel_width, drag_to.y + sel_height, &rcDrag)) 390 rcDrag.left = -1; 391 392 if (rcPrevDrag.left != -1 && rcDrag.left != -1) { 393 UnionRect(&rcDrag, &rcDrag, &rcPrevDrag); 394 } else 395 if (rcDrag.left == -1) { 396 rcDrag = rcPrevDrag; 397 } 398 399 if (rcDrag.left != -1) 400 InvalidateRect(&rcDrag, FALSE); 376 401 } 377 402 … … 490 515 if (scroll.x != last_x) { 491 516 ScrollWindow((last_x - scroll.x) * font_size.cx, 0); 492 UpdateWindow();493 517 GetParent().SendMessage(WM_COMMAND, MAKEWPARAM(ID_PATTERNEDITOR_SCROLLED, 0), 0); 494 518 } … … 524 548 525 549 if (scroll.y != last_y) { 526 LockWindowUpdate();527 550 ScrollWindow(0, (last_y - scroll.y) * font_size.cy); 528 UpdateWindow();529 551 GetParent().SendMessage(WM_COMMAND, MAKEWPARAM(ID_PATTERNEDITOR_SCROLLED, 0), 0); 530 LockWindowUpdate(FALSE);531 552 } 532 553 … … 971 992 ScrollWindow((scroll.x - new_scroll.x) * font_size.cx, (scroll.y - new_scroll.y) * font_size.cy, 0); 972 993 scroll = new_scroll; 973 UpdateWindow();974 994 UpdateCaretPosition(); 975 995 GetParent().SendMessage(WM_COMMAND, MAKEWPARAM(ID_PATTERNEDITOR_SCROLLED, 0), 0); … … 1017 1037 1018 1038 void CPatternEditorInner::SelectRange(int from_col, int from_row, int to_col, int to_row) { 1039 RECT rcPrevSel; 1040 if (!GetSelectionRectScreen(&rcPrevSel)) 1041 rcPrevSel.left = -1; 1042 1019 1043 select_first.x = from_col; 1020 1044 select_first.y = from_row; … … 1031 1055 SortSelection(); 1032 1056 if (!m_hWnd) return ; 1033 Invalidate(FALSE); 1034 GetParent().SendMessage(WM_COMMAND, MAKEWPARAM(ID_PATTERNEDITOR_SELCHANGED, 0), 0); 1057 1058 RECT rcSel; 1059 if (!GetSelectionRectScreen(&rcSel)) 1060 rcSel.left = -1; 1061 1062 if (rcSel.left != -1 && rcPrevSel.left != -1) { 1063 UnionRect(&rcSel, &rcSel, &rcPrevSel); 1064 } else 1065 if (rcSel.left == -1) { 1066 rcSel = rcPrevSel; 1067 } 1068 1069 if (rcSel.left != -1) { 1070 InvalidateRect(&rcSel, FALSE); 1071 GetParent().SendMessage(WM_COMMAND, MAKEWPARAM(ID_PATTERNEDITOR_SELCHANGED, 0), 0); 1072 } 1035 1073 } 1036 1074
