浏览代码

Refactoring

(cherry picked from commit 37bdb8a913113e83194f00ba16d863e5cb27b5aa)

Source commit: cc2750c5718bf1ebbfae817431762ba4536e3877
Martin Prikryl 5 年之前
父节点
当前提交
8882f80fee
共有 2 个文件被更改,包括 8 次插入4 次删除
  1. 7 4
      source/forms/CustomScpExplorer.cpp
  2. 1 0
      source/forms/CustomScpExplorer.h

+ 7 - 4
source/forms/CustomScpExplorer.cpp

@@ -9373,6 +9373,11 @@ void __fastcall TCustomScpExplorerForm::NoteTimer(TObject * /*Sender*/)
   CancelNote(true);
 }
 //---------------------------------------------------------------------------
+void __fastcall TCustomScpExplorerForm::UpdateNoteHints()
+{
+  FNoteHints = FNotes->Text.TrimRight();
+}
+//---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::AddNote(UnicodeString Note, bool UpdateNow)
 {
   int P = Note.Pos(L"\n");
@@ -9390,8 +9395,7 @@ void __fastcall TCustomScpExplorerForm::AddNote(UnicodeString Note, bool UpdateN
 
   if (UpdateNow)
   {
-    FNoteHints = FNotes->Text;
-    FNoteHints.Delete(FNoteHints.Length() - 1, 2);
+    UpdateNoteHints();
     UpdateStatusBar();
   }
 }
@@ -9405,8 +9409,7 @@ void __fastcall TCustomScpExplorerForm::PostNote(UnicodeString Note,
     Note.SetLength(P - 1);
   }
 
-  FNoteHints = FNotes->Text;
-  FNoteHints.Delete(FNoteHints.Length() - 1, 2);
+  UpdateNoteHints();
   FNote = Note;
   SAFE_DESTROY(FNoteData);
   FNoteData = NoteData;

+ 1 - 0
source/forms/CustomScpExplorer.h

@@ -593,6 +593,7 @@ protected:
   void __fastcall PostNote(UnicodeString Note, unsigned int Seconds,
     TNotifyEvent OnNoteClick, TObject * NoteData);
   bool __fastcall CancelNote(bool Force);
+  void __fastcall UpdateNoteHints();
   void __fastcall UpdatesChecked();
   void __fastcall UpdatesNoteClicked(TObject * Sender);
   void __fastcall TransferPresetNoteClicked(TObject * Sender);