~ubuntu-branches/ubuntu/saucy/filezilla/saucy-proposed

« back to all changes in this revision

Viewing changes to src/interface/wrapengine.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adrien Cunin
  • Date: 2011-08-06 14:07:50 UTC
  • mfrom: (1.1.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20110806140750-eexnm3ch307onw2j
Tags: 3.5.0-0ubuntu1
* Package taken from Debian's git, not yet uploaded to Debian
* New upstream release (Closes: #630687, LP: #791550)
   - Closes: #624057 (use of GnuTLS deprecated functions)
* debian/rules: fixed typo in "override_dh_installchangelogs" (upstream
  changelog was not installed anymore due to this)
* Updated debian/patches/01_remove-xdg-check.patch to apply correctly
* Added libsqlite3-dev to build-deps as it's needed now
* Updated Standards-Version to 3.9.2, no change needed
* Added debian/patches/02_dbus_utf8.patch: fixes a crash with some locales,
  committed upstream after 3.5.0, written by Nobuhiro Ban, thanks!
  (Closes: #631718)

Show diffs side-by-side

added added

removed removed

Lines of Context:
204
204
        if (!m_font.IsOk())
205
205
                m_font = parent->GetFont();
206
206
 
 
207
#ifdef __WXDEBUG__
 
208
        const wxString original = text;
 
209
#endif
 
210
 
207
211
        if (m_wrapOnEveryChar)
208
212
        {
209
 
#ifdef __WXDEBUG__
210
 
                const wxString original = text;
211
 
#endif
212
213
                bool res = WrapTextChinese(parent, text, maxLength);
213
214
#ifdef __WXDEBUG__
214
215
                wxString unwrapped = UnwrapText(text);
265
266
 
266
267
                if (lineLength + spaceWidth + width > maxLength)
267
268
                {
 
269
                        // Cannot be appended to current line without overflow, so start a new line
268
270
                        if (wrappedText != _T(""))
269
271
                                wrappedText += _T("\n");
270
272
                        wrappedText += text.Mid(start, wrapAfter - start);
271
273
                        if (text[wrapAfter] != ' ' && text[wrapAfter] != '\0')
272
274
                                wrappedText += text[wrapAfter];
 
275
 
273
276
                        if (width + spaceWidth >= (int)maxLength)
274
277
                        {
275
 
                                if (wrappedText != _T(""))
276
 
                                        wrappedText += _T("\n");
277
 
                                wrappedText += text.Mid(wrapAfter + 1, i - wrapAfter - 1);
 
278
                                // Current segment too big to even fit into a line just by itself
 
279
 
 
280
                                if( i != wrapAfter )
 
281
                                {
 
282
                                        if (wrappedText != _T(""))
 
283
                                                wrappedText += _T("\n");
 
284
                                        wrappedText += text.Mid(wrapAfter + 1, i - wrapAfter - 1);
 
285
                                }
278
286
 
279
287
                                start = i + 1;
280
288
                                wrapAfter = -1;
318
326
 
319
327
        text = wrappedText;
320
328
 
 
329
#ifdef __WXDEBUG__
 
330
                wxString unwrapped = UnwrapText(text);
 
331
                wxASSERT(original == unwrapped);
 
332
#endif
 
333
 
321
334
        return true;
322
335
}
323
336
 
346
359
        
347
360
#if WRAPDEBUG >= 3
348
361
        static int level = 1;
349
 
    plvl printf("Enter\n");
 
362
        plvl printf("Enter with max = %d\n", max);
350
363
#endif
351
364
 
352
365
        if (max <= 0)
381
394
 
382
395
                if (min.GetWidth() + item->GetPosition().x + lborder + rborder <= max)
383
396
                    continue;
384
 
                        
 
397
 
385
398
                wxWindow* window;
386
399
                wxSizer* subSizer = 0;
387
400
                if ((window = item->GetWindow()))
438
451
                                }
439
452
                                continue;
440
453
                        }
 
454
 
 
455
                        if (wxDynamicCast(window, wxCheckBox) || wxDynamicCast(window, wxRadioButton) || wxDynamicCast(window, wxChoice))
 
456
                        {
 
457
#if WRAPDEBUG >= 3
 
458
                                plvl printf("Leave: WrapRecursive on unshrinkable controls failed\n");
 
459
#endif
 
460
                                result |= wrap_failed;
 
461
                                return result;
 
462
                        }
 
463
 
 
464
                        // We assume here that all other oversized controls can scale
441
465
                }
442
466
                else if ((subSizer = item->GetSizer()))
443
467
                {
525
549
#ifdef __WXMAC__
526
550
                        const int offset = 6;
527
551
#elif defined(__WXGTK__)
528
 
                        const int offset = 4;
 
552
                        const int offset = 0;
529
553
#else
530
554
                        const int offset = 0;
531
555
#endif
593
617
#ifdef __WXMAC__
594
618
                        const int offset = 6;
595
619
#elif defined(__WXGTK__)
596
 
                        const int offset = 4;
 
620
                        const int offset = 0;
597
621
#else
598
622
                        const int offset = 0;
599
623
#endif
681
705
        }
682
706
#if WRAPDEBUG > 0               
683
707
                printf("Performing final wrap with bestwidth %d\n", bestWidth);
684
 
#endif          
 
708
#endif
 
709
#ifdef __WXMAC__
 
710
                        const int offset = 6;
 
711
#elif defined(__WXGTK__)
 
712
                        const int offset = 0;
 
713
#else
 
714
                        const int offset = 0;
 
715
#endif
685
716
        for (std::vector<wxWindow*>::iterator iter = all_windows.begin(); iter != all_windows.end(); iter++)
686
717
        {
687
718
                wxSizer *pSizer = (*iter)->GetSizer();
688
719
 
689
 
                int res = WrapRecursive(*iter, pSizer, bestWidth);
 
720
                int res = WrapRecursive(*iter, pSizer, bestWidth - offset);
690
721
 
691
722
                if (res & wrap_didwrap)
692
723
                {