X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flayout.cpp;h=1cf35c722a3a95476532ec1d35898aa7a0e5b903;hb=b391f4b774d17c53dfd9062fc7c7a6b14f72f926;hp=b4cd7683c6bc60d2b615c7c46323b773e4a668cf;hpb=c90e083d1b6c9ce754765a38bf2c14de89993ed5;p=libs%2Fgltk.git diff --git a/source/layout.cpp b/source/layout.cpp index b4cd768..1cf35c7 100644 --- a/source/layout.cpp +++ b/source/layout.cpp @@ -362,7 +362,7 @@ void Layout::solve_constraints(int dir, SolveMode mode) columns of a widget are its position and dimension, respectively. The remaining three are slack columns; see below for their purposes. */ LinearProgram linprog(n_active_slots*5+n_slack_vars[dir]+1); - float weight = slots.size(); + float weight = slots.size()+1; unsigned k = n_active_slots*5; for(list::iterator i=slots.begin(); i!=slots.end(); ++i) { @@ -439,14 +439,15 @@ void Layout::solve_constraints(int dir, SolveMode mode) { LinearProgram::Row row = linprog.add_row(); float polarity = ((j->type&SELF_DIM) ? -1 : 1); + float dim_weight = ((j->type&HALF_DIM) ? 0.5f : 1); if(j->type&SELF_POS) row[(*i)->index*5] = polarity; if(j->type&SELF_DIM) - row[(*i)->index*5+1] = polarity; + row[(*i)->index*5+1] = polarity*dim_weight; if(j->type&TARGET_POS) row[j->target.index*5] = -polarity; if(j->type&TARGET_DIM) - row[j->target.index*5+1] = -polarity; + row[j->target.index*5+1] = -polarity*dim_weight; if(j->type&SPACING) row.back() = (j->spacing>=0 ? j->spacing : this->*(ptrs.spacing)); if(j->type&SLACK) @@ -626,10 +627,14 @@ void operator>>(const LexicalConverter &conv, Layout::ConstraintType &ctype) ctype = Layout::FAR_LEFT_OF; else if(str=="ALIGN_TOP") ctype = Layout::ALIGN_TOP; + else if(str=="ALIGN_VCENTER") + ctype = Layout::ALIGN_VCENTER; else if(str=="ALIGN_BOTTOM") ctype = Layout::ALIGN_BOTTOM; else if(str=="ALIGN_RIGHT") ctype = Layout::ALIGN_RIGHT; + else if(str=="ALIGN_HCENTER") + ctype = Layout::ALIGN_HCENTER; else if(str=="ALIGN_LEFT") ctype = Layout::ALIGN_LEFT; else if(str=="COPY_WIDTH")