Skip to content

Commit

Permalink
Textctrl hang fix, added comparison match selection on arrow or enter…
Browse files Browse the repository at this point in the history
… use.
  • Loading branch information
bjakja committed Jan 24, 2018
1 parent 549a736 commit 3cf02b7
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 23 deletions.
1 change: 0 additions & 1 deletion Kaiplayer/EditBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ void EditBox::SetLine(int Row, bool setaudio, bool save, bool nochangeline, bool
//}

done:

VideoCtrl *vb = pan->Video;
int pas = vb->vToolbar->videoPlayAfter->GetSelection();
int vsa = vb->vToolbar->videoSeekAfter->GetSelection();
Expand Down
6 changes: 5 additions & 1 deletion Kaiplayer/KaiTextCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void KaiTextCtrl::CalcWrap(bool sendevent)
positioning.clear();
positioning.Add(0);
int w,h,fw=0,fh=0;
GetClientSize(&w,&h);
GetSize(&w,&h);
wxMemoryDC dc((bmp) ? *bmp : wxBitmap(10, 10));
dc.SetFont(font);
if(KText!="" && multiline){
Expand All @@ -274,6 +274,7 @@ void KaiTextCtrl::CalcWrap(bool sendevent)
size_t len = KText.Len();
bool seekSpace = true;
int mesureSize = w - 10;
if (mesureSize <= 10){ for (int i = 1; i < len; i++){ wraps.Add(i); positioning.Add(5); return; } }
int stylewrap = (style & wxALIGN_CENTER_HORIZONTAL) ? 1 : (style & wxALIGN_RIGHT) ? 2 : 0;
int pos = 5;
while (i < len)
Expand All @@ -299,6 +300,9 @@ void KaiTextCtrl::CalcWrap(bool sendevent)
j--;
continue;
}
else if (0 >= j - podz + 1){
j = allwrap = podz + 1;
}
//else if (i != j){
// size_t res = KText.find(' ', j);
// if (res != -1 && res>podz && res<i){
Expand Down
32 changes: 16 additions & 16 deletions Kaiplayer/SubsGridBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <wx/regex.h>
#include <wx/ffile.h>
#include "KaiMessageBox.h"

#include "SubsGridPreview.h"


bool sortstart(Dialogue *i, Dialogue *j){
Expand Down Expand Up @@ -130,9 +130,9 @@ void SubsGridBase::ChangeLine(unsigned char editionType, Dialogue *line1, int wl
for (size_t i = 0; i < sels.size(); i++){
ChangeCell(cells, sels[i], line1);
}
if (selline){ wline = sels[sels.size() - 1]; }
//if (selline){ wline = sels[sels.size() - 1]; }
}
if (wline >= GetCount() - 1 && selline){
/*if (wline >= GetCount() - 1 && selline){
Dialogue *tmp = new Dialogue();
tmp->State = 1;
int eend = line1->End.mstime;
Expand All @@ -156,9 +156,14 @@ void SubsGridBase::ChangeLine(unsigned char editionType, Dialogue *line1, int wl
Refresh(false);
if (selline){
Edit->SetLine(lastRow, true, true, false, true);
}*/
AdjustWidths(cells);
if (selline)
NextLine();
else{
Refresh(false);
}
SetModified(editionType, false, dummy);

}

void SubsGridBase::ChangeCell(long wcell, int wline, Dialogue *what)
Expand Down Expand Up @@ -677,7 +682,7 @@ void SubsGridBase::ChangeTimes(bool byFrame)

for (auto cur = tmpmap.begin(); cur != tmpmap.end(); cur++){
auto it = cur;
dialc = cur->first;//file->GetDialogue(cur->second);
dialc = cur->first;
it++;
if (!(it != tmpmap.end())){ it = cur; hasend = true; }
if (correctEndTimes > 0 && dialc->End > it->first->Start && !hasend){
Expand Down Expand Up @@ -1366,12 +1371,6 @@ bool SubsGridBase::SetTlMode(bool mode)
SpellErrors.clear();
Refresh(false);
SetModified((mode) ? GRID_TURN_ON_TLMODE : GRID_TURN_OFF_TLMODE);
//VideoCtrl *vb = ((TabPanel*)GetParent())->Video;
//if(vb->GetState()!=None){
// vb->OpenSubs(GetVisible()/*SaveText()*/);
// if(vb->GetState()==Paused){vb->Render();}
// Edit->OnVideo=true;
//}
return false;
}

Expand All @@ -1391,18 +1390,21 @@ void SubsGridBase::NextLine(int dir)
tmp->TextTl = "";
AddLine(tmp);
SetModified(GRID_APPEND_LINE, false);
if(subsFormat>TMP)
AdjustWidths(START|END);
}
int h, w;
GetClientSize(&w, &h);
scPos = MID(0, nebrow - ((h / (GridHeight + 1)) / 2), GetCount() - 1);
file->ClearSelections();
file->InsertSelection(nebrow);
lastRow = nebrow;
AdjustWidths(0);
//AdjustWidths(0);
Refresh(false);
Edit->SetLine(nebrow, true, true, false, true);
//if(Edit->ABox){Edit->ABox->audioDisplay->SetDialogue(Edit->line,nebrow);}

SubsGrid *grid = (SubsGrid*)this;
if (Comparison){ grid->ShowSecondComparedLine(nebrow); }
else if (grid->preview){ grid->preview->NewSeeking(); }
}


Expand All @@ -1424,8 +1426,6 @@ void SubsGridBase::LoadDefault(bool line, bool sav, bool endload)
AddSInfo("ScriptType", "v4.00+", sav);
AddSInfo("Last Style Storage", "Default", sav);
AddSInfo("YCbCr Matrix", "TV.601", sav);
//Kai->Toolbar->UpdateId(SaveSubs, false);
//Kai->Menubar->Enable(SaveSubs, false);
if (endload){
file->EndLoad(NEW_SUBTITLES, 0);
}
Expand Down
2 changes: 2 additions & 0 deletions Kaiplayer/SubsGridWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,8 @@ void SubsGridWindow::OnKeyPress(wxKeyEvent &event) {
else{
ScrollTo(next);
}
if (Comparison){ ShowSecondComparedLine(next); }
else if (preview){ preview->NewSeeking(); }
lastRow = next;
//return;
}
Expand Down
4 changes: 2 additions & 2 deletions Kaiplayer/SubsGridWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class SubsGridWindow : public SubsGridBase
void SelVideoLine(int time = -1);
void SetStyle();
void SetVideoLineTime(wxMouseEvent &evt);
void ShowSecondComparedLine(int Line, bool showPreview = false, bool fromPreview = false);
SubsGridPreview *preview = NULL;

protected:
void OnKeyPress(wxKeyEvent &event);
Expand All @@ -47,7 +49,6 @@ class SubsGridWindow : public SubsGridBase
void OnScroll(wxScrollWinEvent& event);
void OnSize(wxSizeEvent& event);
void OnLostCapture(wxMouseCaptureLostEvent &evt){ if (HasCapture()){ ReleaseMouse(); } holding = false; };
void ShowSecondComparedLine(int Line, bool showPreview = false, bool fromPreview = false);
bool ShowPreviewWindow(SubsGrid *previewGrid, SubsGrid *windowToDraw, int activeLine, int diffPosition);

int GridWidth[13];
Expand All @@ -61,7 +62,6 @@ class SubsGridWindow : public SubsGridBase

wxBitmap* bmp;
wxFont font;
SubsGridPreview *preview = NULL;
SubsGridPreview *thisPreview = NULL;
private:
virtual void ContextMenu(const wxPoint &pos, bool dummy = false){};
Expand Down
4 changes: 2 additions & 2 deletions Kaiplayer/VersionKainote.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
// This file is for automatic build change
// Autoversioning.exe change it after build using commandline

#define VersionKainote "0.9.2.855"
#define NumVersionKainote 0,9,2,855
#define VersionKainote "0.9.2.858"
#define NumVersionKainote 0,9,2,858
2 changes: 1 addition & 1 deletion Kaiplayer/VideoFullscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void Fullscreen::OnSize()
vslider->SetSize(wxSize(asize.x,14));
if(vc->IsDshow){volslider->Show(); volslider->SetPosition(wxPoint(asize.x-110,17));}
else{volslider->Show(false);}
Videolabel->SetSize(asize.x-114,-1);
Videolabel->SetSize(asize.x-758,-1);
if(vToolbar->IsShown()){vToolbar->SetSize(asize.x, 22);}
panel->SetSize(0, asize.y - panelsize, asize.x, panelsize);
}

0 comments on commit 3cf02b7

Please sign in to comment.