From 3a14ec38dc4c47efb226658891fad41c879816e4 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Tue, 26 Dec 2006 22:02:17 +0000 Subject: [PATCH] Forced move buttons to only work on continuous selection Originally committed to SVN as r630. --- core/dialog_style_manager.cpp | 42 ++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/core/dialog_style_manager.cpp b/core/dialog_style_manager.cpp index 028efa5cc..ede243ba0 100644 --- a/core/dialog_style_manager.cpp +++ b/core/dialog_style_manager.cpp @@ -788,6 +788,19 @@ void DialogStyleManager::UpdateMoveButtons() { } int itemsStor = StorageList->GetCount(); + // Check if selection is continuous + bool contStor = true; + if (n) { + int last = sels[0]; + for (int i=1;iGetSelections(sels); int firstCurr = -1; @@ -798,15 +811,28 @@ void DialogStyleManager::UpdateMoveButtons() { } int itemsCurr = CurrentList->GetCount(); + // Check if selection is continuous + bool contCurr = true; + if (n) { + int last = sels[0]; + for (int i=1;iEnable(firstStor > 0); - StorageMoveTop->Enable(firstStor > 0); - StorageMoveDown->Enable(lastStor != -1 && lastStor < itemsStor-1); - StorageMoveBottom->Enable(lastStor != -1 && lastStor < itemsStor-1); - CurrentMoveUp->Enable(firstCurr > 0); - CurrentMoveTop->Enable(firstCurr > 0); - CurrentMoveDown->Enable(lastCurr != -1 && lastCurr < itemsCurr-1); - CurrentMoveBottom->Enable(lastCurr != -1 && lastCurr < itemsCurr-1); + StorageMoveUp->Enable(contStor && firstStor > 0); + StorageMoveTop->Enable(contStor && firstStor > 0); + StorageMoveDown->Enable(contStor && lastStor != -1 && lastStor < itemsStor-1); + StorageMoveBottom->Enable(contStor && lastStor != -1 && lastStor < itemsStor-1); + CurrentMoveUp->Enable(contCurr && firstCurr > 0); + CurrentMoveTop->Enable(contCurr && firstCurr > 0); + CurrentMoveDown->Enable(contCurr && lastCurr != -1 && lastCurr < itemsCurr-1); + CurrentMoveBottom->Enable(contCurr && lastCurr != -1 && lastCurr < itemsCurr-1); }