mirror of
https://github.com/fltk/fltk.git
synced 2026-05-29 04:26:27 +08:00
Fixes issued raised in STR #3422; Fl_Text_Display constructor order issues;
organize member initialization first, method calls last.
Also:
Reorg'ed member initialization to match order in .H
to detect missing member inits.
Noticed member mModifyingTabDistance is unused.
Tagged with XXX: but left in place, since it's
a protected member, and might be utilized by user code.
We should probably remove this member.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12570 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -558,9 +558,8 @@ protected:
|
|||||||
int mNLinesDeleted; /* Number of lines deleted during
|
int mNLinesDeleted; /* Number of lines deleted during
|
||||||
buffer modification (only used
|
buffer modification (only used
|
||||||
when resynchronization is suppressed) */
|
when resynchronization is suppressed) */
|
||||||
int mModifyingTabDistance; /* Whether tab distance is being
|
int mModifyingTabDistance; /* Whether tab distance is being modified XXX: UNUSED */
|
||||||
modified */
|
|
||||||
|
|
||||||
mutable double mColumnScale; /* Width in pixels of an average character. This
|
mutable double mColumnScale; /* Width in pixels of an average character. This
|
||||||
value is calculated as needed (lazy eval); it
|
value is calculated as needed (lazy eval); it
|
||||||
needs to be mutable so that it can be calculated
|
needs to be mutable so that it can be calculated
|
||||||
|
|||||||
+67
-59
@@ -97,82 +97,90 @@ static int scroll_x = 0;
|
|||||||
*/
|
*/
|
||||||
Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l)
|
Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l)
|
||||||
: Fl_Group(X, Y, W, H, l) {
|
: Fl_Group(X, Y, W, H, l) {
|
||||||
int i;
|
|
||||||
|
|
||||||
mMaxsize = 0;
|
// Member initialization: same order as declared in .H file
|
||||||
|
// Any Fl_Text_Display methods should only be called /after/ all
|
||||||
|
// members initialized; avoids methods referencing uninitialized values.
|
||||||
|
//
|
||||||
damage_range1_start = damage_range1_end = -1;
|
damage_range1_start = damage_range1_end = -1;
|
||||||
damage_range2_start = damage_range2_end = -1;
|
damage_range2_start = damage_range2_end = -1;
|
||||||
dragPos = dragging = 0;
|
mCursorPos = 0;
|
||||||
dragType = DRAG_CHAR;
|
mCursorOn = 0;
|
||||||
display_insert_position_hint = 0;
|
mCursorOldY = -100;
|
||||||
shortcut_ = 0;
|
mCursorToHint = NO_HINT;
|
||||||
|
mCursorStyle = NORMAL_CURSOR;
|
||||||
|
mCursorPreferredXPos = -1;
|
||||||
|
mNVisibleLines = 1;
|
||||||
|
mNBufferLines = 0;
|
||||||
|
mBuffer = NULL;
|
||||||
|
mStyleBuffer = NULL;
|
||||||
|
mFirstChar = 0;
|
||||||
|
mLastChar = 0;
|
||||||
|
mContinuousWrap = 0;
|
||||||
|
mWrapMarginPix = 0;
|
||||||
|
mLineStarts = new int[mNVisibleLines];
|
||||||
|
{ // This code unused unless mNVisibleLines is ever initialized >1
|
||||||
|
for (int i=1; i<mNVisibleLines; i++) mLineStarts[i] = -1;
|
||||||
|
}
|
||||||
|
mLineStarts[0] = 0;
|
||||||
|
mTopLineNum = 1;
|
||||||
|
mAbsTopLineNum = 1;
|
||||||
|
mNeedAbsTopLineNum = 0;
|
||||||
|
mHorizOffset = 0;
|
||||||
|
mTopLineNumHint = 1;
|
||||||
|
mHorizOffsetHint = 0;
|
||||||
|
mNStyles = 0;
|
||||||
|
mStyleTable = NULL;
|
||||||
|
mUnfinishedStyle = 0;
|
||||||
|
mUnfinishedHighlightCB = 0;
|
||||||
|
mHighlightCBArg = 0;
|
||||||
|
mMaxsize = 0;
|
||||||
|
mSuppressResync = 0;
|
||||||
|
mNLinesDeleted = 0;
|
||||||
|
mModifyingTabDistance = 0; // XXX: UNUSED
|
||||||
|
mColumnScale = 0;
|
||||||
|
mCursor_color = FL_FOREGROUND_COLOR;
|
||||||
|
|
||||||
color(FL_BACKGROUND2_COLOR, FL_SELECTION_COLOR);
|
mHScrollBar = new Fl_Scrollbar(0,0,1,1);
|
||||||
box(FL_DOWN_FRAME);
|
mHScrollBar->callback((Fl_Callback*)h_scrollbar_cb, this);
|
||||||
textsize(FL_NORMAL_SIZE);
|
mHScrollBar->type(FL_HORIZONTAL);
|
||||||
textcolor(FL_FOREGROUND_COLOR);
|
|
||||||
textfont(FL_HELVETICA);
|
mVScrollBar = new Fl_Scrollbar(0,0,1,1);
|
||||||
set_flag(SHORTCUT_LABEL);
|
mVScrollBar->callback((Fl_Callback*)v_scrollbar_cb, this);
|
||||||
|
|
||||||
|
scrollbar_width_ = 0; // 0: default from Fl::scrollbar_size()
|
||||||
|
scrollbar_align_ = FL_ALIGN_BOTTOM_RIGHT;
|
||||||
|
|
||||||
|
dragPos = 0;
|
||||||
|
dragType = DRAG_CHAR;
|
||||||
|
dragging = 0;
|
||||||
|
display_insert_position_hint = 0;
|
||||||
|
|
||||||
text_area.x = 0;
|
text_area.x = 0;
|
||||||
text_area.y = 0;
|
text_area.y = 0;
|
||||||
text_area.w = 0;
|
text_area.w = 0;
|
||||||
text_area.h = 0;
|
text_area.h = 0;
|
||||||
|
|
||||||
mVScrollBar = new Fl_Scrollbar(0,0,1,1);
|
shortcut_ = 0;
|
||||||
mVScrollBar->callback((Fl_Callback*)v_scrollbar_cb, this);
|
textfont_ = FL_HELVETICA; // textfont()
|
||||||
mHScrollBar = new Fl_Scrollbar(0,0,1,1);
|
textsize_ = FL_NORMAL_SIZE; // textsize()
|
||||||
mHScrollBar->callback((Fl_Callback*)h_scrollbar_cb, this);
|
textcolor_ = FL_FOREGROUND_COLOR; // textcolor()
|
||||||
mHScrollBar->type(FL_HORIZONTAL);
|
mLineNumLeft = 0;
|
||||||
|
mLineNumWidth = 0;
|
||||||
|
|
||||||
end();
|
|
||||||
|
|
||||||
scrollbar_width_ = 0; // 0: uses Fl::scrollbar_size()
|
|
||||||
scrollbar_align_ = FL_ALIGN_BOTTOM_RIGHT;
|
|
||||||
|
|
||||||
mCursorOn = 0;
|
|
||||||
mCursorPos = 0;
|
|
||||||
mCursorOldY = -100;
|
|
||||||
mCursorToHint = NO_HINT;
|
|
||||||
mCursorStyle = NORMAL_CURSOR;
|
|
||||||
mCursorPreferredXPos = -1;
|
|
||||||
mBuffer = 0;
|
|
||||||
mFirstChar = 0;
|
|
||||||
mLastChar = 0;
|
|
||||||
mNBufferLines = 0;
|
|
||||||
mTopLineNum = mTopLineNumHint = 1;
|
|
||||||
mAbsTopLineNum = 1;
|
|
||||||
mNeedAbsTopLineNum = 0;
|
|
||||||
mHorizOffset = mHorizOffsetHint = 0;
|
|
||||||
|
|
||||||
mCursor_color = FL_FOREGROUND_COLOR;
|
|
||||||
|
|
||||||
mStyleBuffer = 0;
|
|
||||||
mStyleTable = 0;
|
|
||||||
mNStyles = 0;
|
|
||||||
mNVisibleLines = 1;
|
|
||||||
mLineStarts = new int[mNVisibleLines];
|
|
||||||
mLineStarts[0] = 0;
|
|
||||||
for (i=1; i<mNVisibleLines; i++)
|
|
||||||
mLineStarts[i] = -1;
|
|
||||||
mSuppressResync = 0;
|
|
||||||
mNLinesDeleted = 0;
|
|
||||||
mModifyingTabDistance = 0;
|
|
||||||
|
|
||||||
mUnfinishedStyle = 0;
|
|
||||||
mUnfinishedHighlightCB = 0;
|
|
||||||
mHighlightCBArg = 0;
|
|
||||||
|
|
||||||
mLineNumLeft = mLineNumWidth = 0;
|
|
||||||
mContinuousWrap = 0;
|
|
||||||
mWrapMarginPix = 0;
|
|
||||||
mSuppressResync = mNLinesDeleted = mModifyingTabDistance = 0;
|
|
||||||
linenumber_font_ = FL_HELVETICA;
|
linenumber_font_ = FL_HELVETICA;
|
||||||
linenumber_size_ = FL_NORMAL_SIZE;
|
linenumber_size_ = FL_NORMAL_SIZE;
|
||||||
linenumber_fgcolor_ = FL_INACTIVE_COLOR;
|
linenumber_fgcolor_ = FL_INACTIVE_COLOR;
|
||||||
linenumber_bgcolor_ = 53; // ~90% gray
|
linenumber_bgcolor_ = 53; // ~90% gray
|
||||||
linenumber_align_ = FL_ALIGN_RIGHT;
|
linenumber_align_ = FL_ALIGN_RIGHT;
|
||||||
linenumber_format_ = strdup("%d");
|
linenumber_format_ = strdup("%d");
|
||||||
|
|
||||||
|
// Method calls -- only AFTER all members initialized
|
||||||
|
color(FL_BACKGROUND2_COLOR, FL_SELECTION_COLOR);
|
||||||
|
box(FL_DOWN_FRAME);
|
||||||
|
set_flag(SHORTCUT_LABEL);
|
||||||
|
|
||||||
|
end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user