2 // This file is part of the aMule Project.
4 // Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2002 Merkur ( devs@emule-project.net / http://www.emule-project.net )
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #include <wx/menu.h> // Needed for wxMenu
27 #include <wx/fileconf.h> // Needed for wxConfig
28 #include <wx/tokenzr.h> // Needed for wxStringTokenizer
29 #include <wx/imaglist.h> // Needed for wxImageList
31 #include <common/MuleDebug.h> // Needed for MULE_VALIDATE_
32 #include <common/StringFunctions.h> // Needed for StrToLong
34 #include <common/MenuIDs.h>
36 #include "MuleListCtrl.h" // Interface declarations
37 #include "GetTickCount.h" // Needed for GetTickCount()
38 #include "OtherFunctions.h"
42 #include "pixmaps/sort_dn.xpm"
43 #include "pixmaps/sort_up.xpm"
44 #include "pixmaps/sort_dnx2.xpm"
45 #include "pixmaps/sort_upx2.xpm"
50 const int COL_SIZE_MIN
= 10;
51 #elif defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXCOCOA__)
52 const int COL_SIZE_MIN
= 0;
54 #error Need to define COL_SIZE_MIN for your OS
58 BEGIN_EVENT_TABLE(CMuleListCtrl
, MuleExtern::wxGenericListCtrl
)
59 EVT_LIST_COL_CLICK( -1, CMuleListCtrl::OnColumnLClick
)
60 EVT_LIST_COL_RIGHT_CLICK( -1, CMuleListCtrl::OnColumnRClick
)
61 EVT_LIST_ITEM_SELECTED(-1, CMuleListCtrl::OnItemSelected
)
62 EVT_LIST_ITEM_DESELECTED(-1, CMuleListCtrl::OnItemSelected
)
63 EVT_LIST_DELETE_ITEM(-1, CMuleListCtrl::OnItemDeleted
)
64 EVT_LIST_DELETE_ALL_ITEMS(-1, CMuleListCtrl::OnAllItemsDeleted
)
65 EVT_CHAR( CMuleListCtrl::OnChar
)
66 EVT_MENU_RANGE(MP_LISTCOL_1
, MP_LISTCOL_15
, CMuleListCtrl::OnMenuSelected
)
67 EVT_MOUSEWHEEL(CMuleListCtrl::OnMouseWheel
)
71 //! Shared list of arrow-pixmaps
72 static wxImageList
imgList(16, 16, true, 0);
75 CMuleListCtrl::CMuleListCtrl(wxWindow
*parent
, wxWindowID winid
, const wxPoint
& pos
, const wxSize
& size
, long style
, const wxValidator
& validator
, const wxString
& name
)
76 : MuleExtern::wxGenericListCtrl(parent
, winid
, pos
, size
, style
, validator
, name
)
83 if (imgList
.GetImageCount() == 0) {
84 imgList
.Add(wxBitmap(sort_dn_xpm
));
85 imgList
.Add(wxBitmap(sort_up_xpm
));
86 imgList
.Add(wxBitmap(sort_dnx2_xpm
));
87 imgList
.Add(wxBitmap(sort_upx2_xpm
));
90 // Default sort-order is to sort by the first column (asc).
91 m_sort_orders
.push_back(CColPair(0, 0));
93 SetImageList(&imgList
, wxIMAGE_LIST_SMALL
);
97 CMuleListCtrl::~CMuleListCtrl()
99 if (!m_name
.IsEmpty()) {
104 long CMuleListCtrl::InsertColumn(long col
, const wxString
& heading
, int format
, int width
, const wxString
& name
)
106 if (!name
.IsEmpty()) {
108 // Check for valid names
109 wxASSERT_MSG(name
.Find(wxT(':')) == wxNOT_FOUND
, wxT("Column name \"") + name
+ wxT("\" contains invalid characters!"));
110 wxASSERT_MSG(name
.Find(wxT(',')) == wxNOT_FOUND
, wxT("Column name \"") + name
+ wxT("\" contains invalid characters!"));
112 // Check for uniqueness of names.
113 for (ColNameList::const_iterator it
= m_column_names
.begin(); it
!= m_column_names
.end(); ++it
) {
114 if (name
== it
->name
) {
115 wxFAIL_MSG(wxT("Column name \"") + name
+ wxT("\" is not unique!"));
119 // Insert name at position col.
120 ColNameList::iterator it
= m_column_names
.begin();
121 while (it
!= m_column_names
.end() && it
->index
< col
) {
124 m_column_names
.insert(it
, ColNameEntry(col
, width
, name
));
125 while (it
!= m_column_names
.end()) {
131 return MuleExtern::wxGenericListCtrl::InsertColumn(col
, heading
, format
, width
);
134 void CMuleListCtrl::SaveSettings()
136 wxCHECK_RET(!m_name
.IsEmpty(), wxT("Cannot save settings for unnamed list"));
138 wxConfigBase
* cfg
= wxConfigBase::Get();
140 // Save sorting, column and order
142 for (CSortingList::iterator it
= m_sort_orders
.begin(); it
!= m_sort_orders
.end();) {
143 wxString columnName
= GetColumnName(it
->first
);
144 if (!columnName
.IsEmpty()) {
145 sortOrder
+= columnName
;
146 sortOrder
+= wxT(":");
147 sortOrder
+= it
->second
& SORT_DES
? wxT("1") : wxT("0");
148 sortOrder
+= wxT(":");
149 sortOrder
+= it
->second
& SORT_ALT
? wxT("1") : wxT("0");
150 if (++it
!= m_sort_orders
.end()) {
151 sortOrder
+= wxT(",");
158 cfg
->Write(wxT("/eMule/TableOrdering") + m_name
, sortOrder
);
160 // Save column widths. ATM this is also used to signify hidden columns.
162 for (int i
= 0; i
< GetColumnCount(); ++i
) {
163 wxString columnName
= GetColumnName(i
);
164 if (!columnName
.IsEmpty()) {
165 if (!buffer
.IsEmpty()) {
168 int currentwidth
= GetColumnWidth(i
);
169 int savedsize
= (m_column_sizes
.size() && (i
< (int) m_column_sizes
.size())) ? m_column_sizes
[i
] : 0;
170 buffer
<< columnName
<< wxT(":") << ((currentwidth
> 0) ? currentwidth
: (-1 * savedsize
));
174 cfg
->Write(wxT("/eMule/TableWidths") + m_name
, buffer
);
177 void CMuleListCtrl::ParseOldConfigEntries(const wxString
& sortOrders
, const wxString
& columnWidths
)
179 // Set sort order (including sort column)
180 wxStringTokenizer
tokens(sortOrders
, wxT(","));
181 while (tokens
.HasMoreTokens()) {
182 wxString token
= tokens
.GetNextToken();
185 unsigned long order
= 0;
187 if (token
.BeforeFirst(wxT(' ')).Strip(wxString::both
).ToLong(&column
)) {
188 if (token
.AfterFirst(wxT(' ')).Strip(wxString::both
).ToULong(&order
)) {
189 column
= GetNewColumnIndex(column
);
190 // Sanity checking, to avoid asserting if column count changes.
191 if (column
>= 0 && column
< GetColumnCount()) {
192 // Sanity checking, to avoid asserting if data-format changes.
193 if ((order
& ~SORTING_MASK
) == 0) {
194 // SetSorting will take care of duplicate entries
195 SetSorting(column
, order
);
204 wxStringTokenizer
tokenizer(columnWidths
, wxT(","));
205 while (tokenizer
.HasMoreTokens()) {
206 long idx
= GetNewColumnIndex(counter
++);
207 long width
= StrToLong(tokenizer
.GetNextToken());
209 SetColumnWidth(idx
, width
);
214 void CMuleListCtrl::LoadSettings()
216 wxCHECK_RET(!m_name
.IsEmpty(), wxT("Cannot load settings for unnamed list"));
218 wxConfigBase
* cfg
= wxConfigBase::Get();
220 // Load sort order (including sort-column)
221 m_sort_orders
.clear();
222 wxString sortOrders
= cfg
->Read(wxT("/eMule/TableOrdering") + m_name
, wxEmptyString
);
223 wxString columnWidths
= cfg
->Read(wxT("/eMule/TableWidths") + m_name
, wxEmptyString
);
225 // Prevent sorting from occuring when calling SetSorting
226 MuleListCtrlCompare sortFunc
= m_sort_func
;
229 if (columnWidths
.Find(wxT(':')) == wxNOT_FOUND
) {
230 // Old-style config entries...
231 ParseOldConfigEntries(sortOrders
, columnWidths
);
234 wxStringTokenizer
tokens(sortOrders
, wxT(","));
235 while (tokens
.HasMoreTokens()) {
236 wxString token
= tokens
.GetNextToken();
237 wxString name
= token
.BeforeFirst(wxT(':'));
238 long order
= StrToLong(token
.AfterFirst(wxT(':')).BeforeLast(wxT(':')));
239 long alt
= StrToLong(token
.AfterLast(wxT(':')));
240 int col
= GetColumnIndex(name
);
242 SetSorting(col
, (order
? SORT_DES
: 0) | (alt
? SORT_ALT
: 0));
247 wxStringTokenizer
tkz(columnWidths
, wxT(","));
248 while (tkz
.HasMoreTokens()) {
249 wxString token
= tkz
.GetNextToken();
250 wxString name
= token
.BeforeFirst(wxT(':'));
251 long width
= StrToLong(token
.AfterFirst(wxT(':')));
252 int col
= GetColumnIndex(name
);
254 if (col
>= (int) m_column_sizes
.size()) {
255 m_column_sizes
.resize(col
+ 1, 0);
257 m_column_sizes
[col
] = abs(width
);
258 SetColumnWidth(col
, (width
> 0) ? width
: 0);
263 // Must have at least one sort-order specified
264 if (m_sort_orders
.empty()) {
265 m_sort_orders
.push_back(CColPair(0, 0));
268 // Re-enable sorting and resort the contents (if any).
269 m_sort_func
= sortFunc
;
274 const wxString
& CMuleListCtrl::GetColumnName(int index
) const
276 for (ColNameList::const_iterator it
= m_column_names
.begin(); it
!= m_column_names
.end(); ++it
) {
277 if (it
->index
== index
) {
284 int CMuleListCtrl::GetColumnDefaultWidth(int index
) const
286 for (ColNameList::const_iterator it
= m_column_names
.begin(); it
!= m_column_names
.end(); ++it
) {
287 if (it
->index
== index
) {
288 return it
->defaultWidth
;
291 return wxLIST_AUTOSIZE
;
294 int CMuleListCtrl::GetColumnIndex(const wxString
& name
) const
296 for (ColNameList::const_iterator it
= m_column_names
.begin(); it
!= m_column_names
.end(); ++it
) {
297 if (it
->name
== name
) {
304 int CMuleListCtrl::GetNewColumnIndex(int oldindex
) const
306 wxStringTokenizer
oldcolumns(GetOldColumnOrder(), wxT(","), wxTOKEN_RET_EMPTY_ALL
);
308 while (oldcolumns
.HasMoreTokens()) {
309 wxString name
= oldcolumns
.GetNextToken();
311 return GetColumnIndex(name
);
318 long CMuleListCtrl::GetInsertPos(wxUIntPtr data
)
320 // Find the best place to position the item through a binary search
322 int Max
= GetItemCount();
324 // Only do this if there are any items and a sorter function.
325 // Otherwise insert at end.
326 if (Max
&& m_sort_func
) {
327 // This search will find the place to position the new item
328 // so it matches current sorting.
329 // The result will be the position the new item will have
330 // after insertion, which is the format expected by the InsertItem function.
331 // If the item equals another item it will be inserted after it.
333 int cur_pos
= ( Max
- Min
) / 2 + Min
;
334 int cmp
= CompareItems(data
, GetItemData(cur_pos
));
336 // Value is less than the one at the current pos
342 } while ((Min
!= Max
));
349 int CMuleListCtrl::CompareItems(wxUIntPtr item1
, wxUIntPtr item2
)
351 CSortingList::const_iterator it
= m_sort_orders
.begin();
352 for (; it
!= m_sort_orders
.end(); ++it
) {
353 int result
= m_sort_func(item1
, item2
, it
->first
| it
->second
);
359 // Ensure that different items are never considered equal.
360 return CmpAny(item1
, item2
);
363 int CMuleListCtrl::SortProc(wxUIntPtr item1
, wxUIntPtr item2
, long data
)
365 MuleSortData
* sortdata
= (MuleSortData
*) data
;
366 const CSortingList
& orders
= sortdata
->m_sort_orders
;
368 CSortingList::const_iterator it
= orders
.begin();
369 for (; it
!= orders
.end(); ++it
) {
370 int result
= sortdata
->m_sort_func(item1
, item2
, it
->first
| it
->second
);
376 // Ensure that different items are never considered equal.
377 return CmpAny(item1
, item2
);
380 void CMuleListCtrl::SortList()
382 if (!IsSorting() && (m_sort_func
&& GetColumnCount())) {
386 // Positions are likely to be invalid after sorting.
389 MuleSortData
sortdata(m_sort_orders
, m_sort_func
);
391 // Store the current selected items
392 ItemDataList selectedItems
= GetSelectedItems();
393 // Store the focused item
394 long pos
= GetNextItem( -1, wxLIST_NEXT_ALL
, wxLIST_STATE_FOCUSED
);
395 wxUIntPtr focused
= (pos
== -1) ? 0 : GetItemData(pos
);
397 SortItems(SortProc
, (long int)&sortdata
);
399 // Re-select the selected items.
400 for (unsigned i
= 0; i
< selectedItems
.size(); ++i
) {
401 long it_pos
= FindItem(-1, selectedItems
[i
]);
403 SetItemState(it_pos
, wxLIST_STATE_SELECTED
, wxLIST_STATE_SELECTED
);
407 // Set focus on item if any was focused
409 long it_pos
= FindItem(-1, focused
);
411 SetItemState(it_pos
, wxLIST_STATE_FOCUSED
, wxLIST_STATE_FOCUSED
);
419 CMuleListCtrl::ItemDataList
CMuleListCtrl::GetSelectedItems() const
421 // Create the initial vector with as many items as are selected
422 ItemDataList
list( GetSelectedItemCount() );
424 // Current item being located
425 unsigned int current
= 0;
427 long pos
= GetNextItem( -1, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
428 while ( pos
!= -1 ) {
429 wxASSERT( current
< list
.size() );
431 list
[ current
++ ] = GetItemData( pos
);
433 pos
= GetNextItem( pos
, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
440 void CMuleListCtrl::OnColumnRClick(wxListEvent
& evt
)
445 for ( int i
= 0; i
< GetColumnCount() && i
< 15; ++i
) {
448 menu
.AppendCheckItem(i
+ MP_LISTCOL_1
, item
.GetText() );
449 menu
.Check( i
+ MP_LISTCOL_1
, GetColumnWidth(i
) > COL_SIZE_MIN
);
452 PopupMenu(&menu
, evt
.GetPoint());
456 void CMuleListCtrl::OnMenuSelected( wxCommandEvent
& evt
)
458 unsigned int col
= evt
.GetId() - MP_LISTCOL_1
;
460 if (col
>= m_column_sizes
.size()) {
461 m_column_sizes
.resize(col
+ 1, 0);
464 if (GetColumnWidth(col
) > COL_SIZE_MIN
) {
465 m_column_sizes
[col
] = GetColumnWidth(col
);
466 SetColumnWidth(col
, 0);
468 int oldsize
= m_column_sizes
[col
];
469 SetColumnWidth(col
, (oldsize
> 0) ? oldsize
: GetColumnDefaultWidth(col
));
474 void CMuleListCtrl::OnColumnLClick(wxListEvent
& evt
)
476 // Stop if no sorter-function has been defined
479 } else if (evt
.GetColumn() == -1) {
480 // This happens if a user clicks past the last column header.
484 unsigned sort_order
= 0;
485 if (m_sort_orders
.front().first
== (unsigned)evt
.GetColumn()) {
486 // Same column as before, flip the sort-order
487 sort_order
= m_sort_orders
.front().second
;
489 if (sort_order
& SORT_DES
) {
490 if (AltSortAllowed(evt
.GetColumn())) {
491 sort_order
= (~sort_order
) & SORT_ALT
;
496 sort_order
= SORT_DES
| (sort_order
& SORT_ALT
);
499 m_sort_orders
.pop_front();
501 // Check if the column has already been set
502 CSortingList::iterator it
= m_sort_orders
.begin();
503 for (; it
!= m_sort_orders
.end(); ++it
) {
504 if ((unsigned)evt
.GetColumn() == it
->first
) {
505 sort_order
= it
->second
;
512 SetSorting(evt
.GetColumn(), sort_order
);
516 void CMuleListCtrl::ClearSelection()
518 if (GetSelectedItemCount()) {
519 long index
= GetNextItem(-1, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
520 while (index
!= -1) {
521 SetItemState(index
, 0, wxLIST_STATE_SELECTED
);
522 index
= GetNextItem(index
, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
528 bool CMuleListCtrl::AltSortAllowed(unsigned WXUNUSED(column
)) const
534 void CMuleListCtrl::SetSorting(unsigned column
, unsigned order
)
536 MULE_VALIDATE_PARAMS(column
< (unsigned)GetColumnCount(), wxT("Invalid column to sort by."));
537 MULE_VALIDATE_PARAMS(!(order
& ~SORTING_MASK
), wxT("Sorting order contains invalid data."));
539 if (!m_sort_orders
.empty()) {
540 SetColumnImage(m_sort_orders
.front().first
, -1);
542 CSortingList::iterator it
= m_sort_orders
.begin();
543 for (; it
!= m_sort_orders
.end(); ++it
) {
544 if (it
->first
== column
) {
545 m_sort_orders
.erase(it
);
551 m_sort_orders
.push_front(CColPair(column
, order
));
553 if (order
& SORT_DES
) {
554 SetColumnImage(column
, (order
& SORT_ALT
) ? 2 : 0);
556 SetColumnImage(column
, (order
& SORT_ALT
) ? 3 : 1);
563 bool CMuleListCtrl::IsItemSorted(long item
)
565 wxCHECK_MSG(m_sort_func
, true, wxT("No sort function specified!"));
566 wxCHECK_MSG((item
>= 0) && (item
< GetItemCount()), true, wxT("Invalid item"));
569 wxUIntPtr data
= GetItemData(item
);
571 // Check that the item before the current item is smaller (or equal)
573 sorted
&= (CompareItems(GetItemData(item
- 1), data
) <= 0);
576 // Check that the item after the current item is greater (or equal)
577 if (sorted
&& (item
< GetItemCount() - 1)) {
578 sorted
&= (CompareItems(GetItemData(item
+ 1), data
) >= 0);
585 void CMuleListCtrl::OnMouseWheel(wxMouseEvent
&event
)
587 // This enables scrolling with the mouse wheel
592 void CMuleListCtrl::SetColumnImage(unsigned col
, int image
)
595 item
.SetMask(wxLIST_MASK_IMAGE
);
596 item
.SetImage(image
);
597 SetColumn(col
, item
);
601 long CMuleListCtrl::CheckSelection(wxMouseEvent
& event
)
605 evt
.m_itemIndex
= HitTest(event
.GetPosition(), flags
);
607 return CheckSelection(evt
);
611 long CMuleListCtrl::CheckSelection(wxListEvent
& event
)
613 long item
= event
.GetIndex();
615 // Check if clicked item is selected. If not, unselect all and select it.
616 if ((item
!= -1) && !GetItemState(item
, wxLIST_STATE_SELECTED
)) {
619 SetItemState(item
, wxLIST_STATE_SELECTED
, wxLIST_STATE_SELECTED
);
626 wxString
CMuleListCtrl::GetTTSText(unsigned item
) const
628 MULE_VALIDATE_PARAMS(item
< (unsigned)GetItemCount(), wxT("Invalid row."));
629 MULE_VALIDATE_STATE((GetWindowStyle() & wxLC_OWNERDRAW
) == 0,
630 wxT("GetTTSText must be overwritten for owner-drawn lists."));
632 return GetItemText(item
);
636 void CMuleListCtrl::OnChar(wxKeyEvent
& evt
)
638 int key
= evt
.GetKeyCode();
640 // We prefer GetKeyCode() to GetUnicodeKey(), in order to work
641 // around a bug in the GetUnicodeKey(), that causes values to
642 // be returned untranslated. This means for instance, that if
643 // shift and '1' is pressed, the result is '1' rather than '!'
644 // (as it should be on my keyboard). This has been reported:
645 // http://sourceforge.net/tracker/index.php?func=detail&aid=1864810&group_id=9863&atid=109863
646 key
= evt
.GetUnicodeKey();
647 } else if (key
>= WXK_START
) {
648 // wxKeycodes are ignored, as they signify events such as the 'home'
649 // button. Unicoded chars are not checked as there is an overlap valid
650 // chars and the wx keycodes.
655 // We wish to avoid handling shortcuts, with the exception of 'select-all'.
656 if (evt
.AltDown() || evt
.ControlDown() || evt
.MetaDown()) {
657 if (evt
.CmdDown() && (evt
.GetKeyCode() == 0x01)) {
658 // Ctrl+a (Command+a on Mac) was pressed, select all items
659 for (int i
= 0; i
< GetItemCount(); ++i
) {
660 SetItemState(i
, wxLIST_STATE_SELECTED
, wxLIST_STATE_SELECTED
);
666 } else if (m_tts_time
+ 1500u < GetTickCount()) {
670 m_tts_time
= GetTickCount();
671 m_tts_text
.Append(wxTolower(key
));
673 // May happen if the subclass does not forward deletion events.
674 // Or rather when single-char-repeated (see below) wraps around, so don't assert.
675 if (m_tts_item
>= GetItemCount()) {
679 unsigned next
= (m_tts_item
== -1) ? 0 : m_tts_item
;
680 for (unsigned i
= 0, count
= GetItemCount(); i
< count
; ++i
) {
681 wxString text
= GetTTSText((next
+ i
) % count
).MakeLower();
683 if (text
.StartsWith(m_tts_text
)) {
686 m_tts_item
= (next
+ i
) % count
;
687 SetItemState(m_tts_item
, wxLIST_STATE_FOCUSED
| wxLIST_STATE_SELECTED
,
688 wxLIST_STATE_FOCUSED
| wxLIST_STATE_SELECTED
);
689 EnsureVisible(m_tts_item
);
695 if (m_tts_item
!= -1) {
696 // Crop the string so that it matches the old item (avoid typos).
697 wxString text
= GetTTSText(m_tts_item
).MakeLower();
699 // If the last key didn't result in a hit, then we skip the event.
700 if (!text
.StartsWith(m_tts_text
)) {
701 if ((m_tts_text
.Length() == 2) && (m_tts_text
[0] == m_tts_text
[1])) {
702 // Special case, single-char, repeated. This allows toggeling
703 // between items starting with a specific letter.
705 // Increment, so the next will be selected (or wrap around).
709 m_tts_text
.RemoveLast();
719 void CMuleListCtrl::OnItemSelected(wxListEvent
& evt
)
722 // Selection/Deselection that happened while sorting.
725 // We reset the current TTS session if the user manually changes the selection
726 if (m_tts_item
!= evt
.GetIndex()) {
729 // The item is changed so that the next TTS starts from the selected item.
730 m_tts_item
= evt
.GetIndex();
737 void CMuleListCtrl::OnItemDeleted(wxListEvent
& evt
)
739 if (evt
.GetIndex() <= m_tts_item
) {
747 void CMuleListCtrl::OnAllItemsDeleted(wxListEvent
& evt
)
755 void CMuleListCtrl::ResetTTS()
761 wxString
CMuleListCtrl::GetOldColumnOrder() const
763 return wxEmptyString
;
765 // File_checked_for_headers