Skip to content

Commit

Permalink
Fix work modified status
Browse files Browse the repository at this point in the history
  • Loading branch information
Gankov committed May 3, 2016
1 parent eef191a commit 67bc784
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions RdlDesign/RdlEditPreview.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public RdlEditPreview()

//ScintillaNET Init
ConfigureScintillaStyle(scintilla1);
scintilla1.TextChanged += scintilla1_TextChanged;

tbEditor.SelectionChanged +=new EventHandler(tbEditor_SelectionChanged);
// adjust size of line box by measuring a large #
Expand All @@ -139,6 +140,16 @@ public RdlEditPreview()

}

void scintilla1_TextChanged(object sender, EventArgs e)
{
_DesignChanged = DesignTabs.NewEdit;

if (OnRdlChanged != null)
{
OnRdlChanged(this, e);
}
}

private void ConfigureScintillaStyle(ScintillaNET.Scintilla scintilla)
{
// Reset the styles
Expand Down Expand Up @@ -337,12 +348,19 @@ public bool Modified
{
get
{
return tbEditor.Modified;
if(_CurrentTab == DesignTabs.NewEdit)
return scintilla1.Modified;
else
return tbEditor.Modified;
}
set
{
_DesignChanged = _CurrentTab;
tbEditor.Modified = value;
if (_CurrentTab == DesignTabs.NewEdit)
if(value == false)
scintilla1.SetSavePoint();
else
tbEditor.Modified = value;
}
}

Expand Down Expand Up @@ -998,8 +1016,9 @@ private void tcEHP_SelectedIndexChanged(object sender, System.EventArgs e)
case DesignTabs.Design:
// sync up the editor
tbEditor.Text = dcDesign.ReportSource;
tbEditor.Modified = true;
tbEditor.Modified = false;
scintilla1.Text = dcDesign.ReportSource;
scintilla1.SetSavePoint();
break;
case DesignTabs.Edit:
case DesignTabs.Preview:
Expand All @@ -1022,7 +1041,10 @@ private void tcEHP_SelectedIndexChanged(object sender, System.EventArgs e)
{
try
{
dcDesign.ReportSource = tbEditor.Text;
if(_DesignChanged == DesignTabs.NewEdit)
dcDesign.ReportSource = scintilla1.Text;
else
dcDesign.ReportSource = tbEditor.Text;
}
catch (Exception ge)
{
Expand Down

0 comments on commit 67bc784

Please sign in to comment.